import de.juplo.thymeleaf.JuploDialect;
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;
+import org.springframework.web.servlet.View;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
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;
@SpringBootApplication
public class Application extends WebMvcConfigurerAdapter
{
+ @Autowired
+ private ServerProperties properties;
+
+
@Bean
public RegexUrlHandlerMapping proxiedHandlerMapping(
ProxyHttpRequestHandler proxy,
}
@Bean
- public ThymeleafView error(SpringTemplateEngine templateEngine)
+ public View error(ThymeleafViewResolver resolver) throws Exception
+ {
+ return resolver.resolveViewName("templates/500", Locale.getDefault());
+ }
+
+ @Bean
+ public ExceptionMappings exceptionMappings()
{
- return new ErrorThymeleafView(templateEngine, "/thymeleaf/error.html");
+ return new ExceptionMappings();
}
+
@Override
public void addViewControllers(ViewControllerRegistry registry)
{
{
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