title: Spring Boot handle 404
body: <p>I'm struggling with the error handling in spring, specially with the 404 error.</p>
  
  <p>I have a <code>ExceptionController</code> with the <code>ControllerAdvice</code> annotation, with this i handle the 403 error, like this:</p>
  
  <pre><code>@ExceptionHandler(AccessDeniedException.class)
  public String handleAccessDeniedException(AccessDeniedException ex, HttpServletRequest request)
  {
      return "403";
  }
  </code></pre>
  
  <p>But i'm not able to handle 404 the same way.</p>
  
  <p>I have read about to create an own DispatcherServlet and set ThrowExceptionIfNohandlerFound to true. But this doesn't work for me</p>
  
  <p>Source: <a href="https://stackoverflow.com/q/24498662/1809221">HOWTO handle 404 exceptions globally using Spring MVC configured using Java based Annotations</a> , <a href="https://stackoverflow.com/a/27224123/1809221">https://stackoverflow.com/a/27224123/1809221</a> , <a href="https://stackoverflow.com/a/34973476/1809221">https://stackoverflow.com/a/34973476/1809221</a></p>
  
  <p>After this i found a nice and clean solution: <a href="https://stackoverflow.com/a/25805387/1809221">https://stackoverflow.com/a/25805387/1809221</a></p>
  
  <p>But with this i doesn't get my custome 404 i get a blank white page.</p>
  
  <p>Any ideas?</p>
  
  <p>Thank's in advance</p>