如何排除SpringBoot默认的异常管理逻辑
@SpringBootApplication(exclude = ErrorMvcAutoConfiguration.class)
实现自定义的异常处理页面
http://blog.csdn.net/whatlookingfor/article/details/51548923
404.html、500.html
实现ErrorPageRegistrar接口,注册错误页面
@Component
public class CommonErrorPageRegistrar implements ErrorPageRegistrar{
@Override
public void registerErrorPages(ErrorPageRegistry registry) {
ErrorPage error404 = new ErrorPage(HttpStatus.NOT_FOUND, "/error_page/404.html");
ErrorPage error500 = new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR, "/error_page/500.html");
registry.addErrorPages(error404, error500);
}
}