X-Git-Url: https://juplo.de/gitweb/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fde%2Fjuplo%2Fthymeproxy%2FApplication.java;h=6a3d7da06f5544605e081c0443f1693ac5112e68;hb=53d411dcd6f52a22ec4513a9d43b3b5f737655a1;hp=6b0ad09edf6a5a75287a01b99fbf94d57af86195;hpb=47ba6f9913adb987a0fda0e25e101ae34297d725;p=maven-thymeleaf-skin diff --git a/src/main/java/de/juplo/thymeproxy/Application.java b/src/main/java/de/juplo/thymeproxy/Application.java index 6b0ad09..6a3d7da 100644 --- a/src/main/java/de/juplo/thymeproxy/Application.java +++ b/src/main/java/de/juplo/thymeproxy/Application.java @@ -15,6 +15,7 @@ import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.core.Ordered; import org.springframework.core.env.Environment; +import org.springframework.http.HttpStatus; import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; import org.springframework.web.servlet.handler.SimpleMappingExceptionResolver; @@ -124,7 +125,7 @@ public class Application extends WebMvcConfigurerAdapter mappings.setProperty("TemplateInputException", "templates/404"); resolver.setExceptionMappings(mappings); - resolver.setDefaultErrorView("templates/500"); + resolver.setDefaultErrorView("templates/error"); resolver.setWarnLogCategory("exception"); return resolver; } @@ -135,11 +136,15 @@ public class Application extends WebMvcConfigurerAdapter ErrorAttributes errorAttributes ) { - return new ExceptionResolverErrorController( - context, - errorAttributes, - properties.getError() - ); + ExceptionResolverErrorController controller = + new ExceptionResolverErrorController( + context, + errorAttributes, + properties.getError() + ); + controller.addErrorMapping(HttpStatus.NOT_FOUND, "templates/404"); + controller.setDefaultErrorView("templates/error"); + return controller; }