X-Git-Url: https://juplo.de/gitweb/?p=maven-thymeleaf-skin;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fde%2Fjuplo%2Fthymeproxy%2FApplication.java;h=b5a38cd1f1f12486107401c0253ed0b7b3be3439;hp=2adafb2ab14ce5f459ad5cbfeeaca6fcc2b949c3;hb=23bc7e913d4e1afbda0805eea6371f36cf045b6d;hpb=2e1827336be89956cf176b047ebbfa4f30c51b32 diff --git a/src/main/java/de/juplo/thymeproxy/Application.java b/src/main/java/de/juplo/thymeproxy/Application.java index 2adafb2..b5a38cd 100644 --- a/src/main/java/de/juplo/thymeproxy/Application.java +++ b/src/main/java/de/juplo/thymeproxy/Application.java @@ -4,7 +4,6 @@ import de.juplo.thymeleaf.JuploDialect; import java.util.HashMap; import java.util.Map; import org.apache.http.impl.client.CloseableHttpClient; -import org.springframework.beans.BeanUtils; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.Bean; @@ -15,8 +14,8 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter import org.springframework.web.servlet.mvc.UrlFilenameViewController; import org.thymeleaf.resourceresolver.IResourceResolver; import org.thymeleaf.resourceresolver.UrlResourceResolver; +import org.thymeleaf.spring4.SpringTemplateEngine; import org.thymeleaf.spring4.view.ThymeleafView; -import org.thymeleaf.spring4.view.ThymeleafViewResolver; import org.thymeleaf.templateresolver.TemplateResolver; @@ -106,11 +105,9 @@ public class Application extends WebMvcConfigurerAdapter } @Bean - public ThymeleafView error() + public ThymeleafView error(SpringTemplateEngine templateEngine) { - ThymeleafView view = BeanUtils.instantiateClass(ThymeleafView.class); - view.setTemplateName("/thymeleaf/error.html"); - return view; + return new ErrorThymeleafView(templateEngine, "/thymeleaf/error.html"); } @Override @@ -124,4 +121,14 @@ public class Application extends WebMvcConfigurerAdapter { SpringApplication.run(Application.class, args); } + + + static class ErrorThymeleafView extends ThymeleafView + { + ErrorThymeleafView(SpringTemplateEngine templateEngine, String templateName) + { + super(templateName); + setTemplateEngine(templateEngine); + } + } } \ No newline at end of file