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;
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;
}
@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
{
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