- ThymeleafView view = BeanUtils.instantiateClass(ThymeleafView.class);
- view.setTemplateName("/thymeleaf/error.html");
- return view;
+ SimpleMappingExceptionResolver resolver =
+ new SimpleMappingExceptionResolver();
+
+ Properties mappings = new Properties();
+ mappings.setProperty("TemplateInputException", "templates/404");
+
+ resolver.setExceptionMappings(mappings);
+ resolver.setDefaultErrorView("templates/500");
+ resolver.setWarnLogCategory("exception");
+ return resolver;