return resolver.resolveViewName("templates/500", Locale.getDefault());
   }
 
+  @Bean
+  public ExceptionMappings exceptionMappings()
+  {
+    return new ExceptionMappings();
+  }
+
 
   @Override
   public void addViewControllers(ViewControllerRegistry registry)
 
--- /dev/null
+package de.juplo.thymeproxy;
+
+
+import javax.servlet.http.HttpServletRequest;
+import org.springframework.http.HttpStatus;
+import org.springframework.web.bind.annotation.ControllerAdvice;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+import org.springframework.web.bind.annotation.ResponseStatus;
+import org.springframework.web.servlet.ModelAndView;
+import org.thymeleaf.exceptions.TemplateInputException;
+
+
+
+/**
+ *
+ * @author Kai Moritz
+ */
+@ControllerAdvice
+public class ExceptionMappings
+{
+  @ResponseStatus(HttpStatus.NOT_FOUND) 
+  @ExceptionHandler(value = TemplateInputException.class)
+  public ModelAndView templateInputExceptionHandler(
+      HttpServletRequest request,
+      TemplateInputException e
+      )
+  {
+    ModelAndView mav = new ModelAndView("templates/404");
+    mav.addObject("template", e.getTemplateName());
+    mav.addObject("uri", request.getRequestURI());
+    return mav;
+  }
+}