From 91aa988e329618f6233b2b2f6394d4948622f4cc Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Sun, 19 Jun 2016 00:08:07 +0200 Subject: [PATCH] WIP: welcom + error - 404 anstatt 500 --- src/main/java/de/juplo/thymeproxy/Application.java | 12 ------------ .../de/juplo/thymeproxy/DefaultExceptionHandler.java | 5 +++++ 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/src/main/java/de/juplo/thymeproxy/Application.java b/src/main/java/de/juplo/thymeproxy/Application.java index 48bea7d..03b106f 100644 --- a/src/main/java/de/juplo/thymeproxy/Application.java +++ b/src/main/java/de/juplo/thymeproxy/Application.java @@ -5,10 +5,8 @@ import java.util.HashMap; import java.util.Locale; import java.util.Map; import org.apache.http.impl.client.CloseableHttpClient; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.autoconfigure.web.ServerProperties; import org.springframework.context.annotation.Bean; import org.springframework.core.Ordered; import org.springframework.core.env.Environment; @@ -25,10 +23,6 @@ import org.thymeleaf.templateresolver.TemplateResolver; @SpringBootApplication public class Application extends WebMvcConfigurerAdapter { - @Autowired - private ServerProperties properties; - - @Bean public RegexUrlHandlerMapping proxiedHandlerMapping( ProxyHttpRequestHandler proxy, @@ -117,12 +111,6 @@ public class Application extends WebMvcConfigurerAdapter return resolver.resolveViewName("templates/500", Locale.getDefault()); } - @Bean - public DefaultExceptionHandler defaultExceptionHandler() - { - return new DefaultExceptionHandler(); - } - @Override public void addViewControllers(ViewControllerRegistry registry) diff --git a/src/main/java/de/juplo/thymeproxy/DefaultExceptionHandler.java b/src/main/java/de/juplo/thymeproxy/DefaultExceptionHandler.java index 6fb89b5..7aaf512 100644 --- a/src/main/java/de/juplo/thymeproxy/DefaultExceptionHandler.java +++ b/src/main/java/de/juplo/thymeproxy/DefaultExceptionHandler.java @@ -18,6 +18,11 @@ import org.thymeleaf.exceptions.TemplateInputException; @ControllerAdvice public class DefaultExceptionHandler { + public DefaultExceptionHandler() + { + } + + @ResponseStatus(HttpStatus.NOT_FOUND) @ExceptionHandler(value = TemplateInputException.class) public ModelAndView templateInputExceptionHandler( -- 2.20.1