2023-07-30 22:31:24 -07:00
|
|
|
package com.wisemapping.config;
|
|
|
|
|
2023-11-19 00:31:41 -08:00
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
2023-07-30 22:31:24 -07:00
|
|
|
import org.springframework.context.annotation.Bean;
|
2023-11-19 15:23:45 -08:00
|
|
|
import org.springframework.context.annotation.ComponentScan;
|
2023-07-30 22:31:24 -07:00
|
|
|
import org.springframework.context.annotation.Configuration;
|
2023-11-19 15:23:45 -08:00
|
|
|
import org.springframework.context.annotation.ImportResource;
|
2023-11-19 00:31:41 -08:00
|
|
|
import org.springframework.transaction.TransactionManager;
|
|
|
|
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
2023-07-30 22:31:24 -07:00
|
|
|
import org.springframework.web.servlet.HandlerExceptionResolver;
|
|
|
|
import org.springframework.web.servlet.ViewResolver;
|
|
|
|
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
|
|
|
import org.springframework.web.servlet.handler.SimpleMappingExceptionResolver;
|
|
|
|
import org.springframework.web.servlet.view.InternalResourceViewResolver;
|
|
|
|
import org.springframework.web.servlet.view.JstlView;
|
|
|
|
|
|
|
|
@EnableWebMvc
|
|
|
|
@Configuration
|
2023-11-19 00:31:41 -08:00
|
|
|
@EnableTransactionManagement
|
2023-11-19 15:23:45 -08:00
|
|
|
@ComponentScan
|
|
|
|
@ImportResource("classpath:spring/wisemapping-common.xml")
|
|
|
|
public class Application {
|
2023-07-30 22:31:24 -07:00
|
|
|
@Bean
|
|
|
|
HandlerExceptionResolver errorHandler() {
|
2023-07-30 22:34:31 -07:00
|
|
|
final SimpleMappingExceptionResolver result = new SimpleMappingExceptionResolver();
|
2023-07-30 22:31:24 -07:00
|
|
|
|
|
|
|
//mapping status code with view response.
|
|
|
|
result.addStatusCode("reactInclude", 403);
|
|
|
|
|
|
|
|
//setting default error view
|
2023-07-30 22:34:31 -07:00
|
|
|
result.setDefaultErrorView("reactInclude");
|
2023-07-30 22:31:24 -07:00
|
|
|
result.setDefaultStatusCode(500);
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Bean
|
|
|
|
public ViewResolver viewResolver(){
|
|
|
|
InternalResourceViewResolver resolver = new InternalResourceViewResolver();
|
|
|
|
resolver.setPrefix("/WEB-INF/views/");
|
|
|
|
resolver.setSuffix(".jsp");
|
|
|
|
resolver.setViewClass(JstlView.class);
|
|
|
|
return resolver;
|
|
|
|
}
|
|
|
|
}
|