title: Spring boot overriding default 404 exception handling
body: <p>I have found a lot of questions and answers around this but it seems no matter what I do I cannot bypass the default white label app page for 404 errors. Using boot version 1.4.x</p>
  
  <p>What I am doing is in my application.yml:</p>
  
  <pre><code>spring:
     mvc:
      throw-exception-if-no-handler-found: true
  </code></pre>
  
  <p>Then defining my own Subclass of <code>ResponseEntityExceptionHandler</code> annotated with <code>@ControllerAdvice</code> where I stick in
   my overridden <code>handleNoHandlerFoundException</code> </p>
  
  <pre><code>    @ControllerAdvice
  public class ThisIsNotWorking extends ResponseEntityExceptionHandler {
  
      @Override
      protected ResponseEntity&lt;Object&gt; handleNoHandlerFoundException(final NoHandlerFoundException ex,
                                                                     final HttpHeaders headers, final HttpStatus status,
                                                                     final WebRequest request) {
          logger.info(ex.getClass().getName());
          final String error = "No handler found for " + ex.getHttpMethod() + " " + ex.getRequestURL();
  </code></pre>
  
  <p>^^only a snippet above not all the logic.</p>
  
  <p>But when I navigate to a bad route for my boot app I get json in browser with error.  What else do I need to do? Ultimately I want to handle these 404s in a custom way for my app. </p>