51 lines
1.9 KiB
Java
51 lines
1.9 KiB
Java
package com.wisemapping.config;
|
|
|
|
import org.springframework.boot.SpringApplication;
|
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
import org.springframework.context.annotation.Bean;
|
|
import org.springframework.context.annotation.ComponentScan;
|
|
import org.springframework.context.annotation.Configuration;
|
|
import org.springframework.context.annotation.ImportResource;
|
|
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
|
|
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
|
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
|
|
@EnableTransactionManagement
|
|
@SpringBootApplication
|
|
@EnableJpaRepositories("com.wisemapping.model")
|
|
@ImportResource("classpath:spring/wisemapping-common.xml")
|
|
public class Application {
|
|
|
|
public static void main(String[] args) {
|
|
SpringApplication.run(Application.class, args);
|
|
}
|
|
|
|
@Bean
|
|
HandlerExceptionResolver errorHandler() {
|
|
final SimpleMappingExceptionResolver result = new SimpleMappingExceptionResolver();
|
|
|
|
//mapping status code with view response.
|
|
result.addStatusCode("reactInclude", 403);
|
|
|
|
//setting default error view
|
|
result.setDefaultErrorView("reactInclude");
|
|
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;
|
|
}
|
|
}
|