title: How to catch all unhandled exceptions (i.e. without existing @ExceptionHandler) in Spring MVC?
body: <p>I want to let HandlerExceptionResolver resolve any Exceptions that I don't explicit catch via  <code>@ExceptionHandler</code> annotation.</p>
  
  <p>Anyways, I want to apply specific logic on those exceptions. Eg send a mail notification or log additionally. I can achieve this by adding a <code>@ExceptionHandler(Exception.class)</code> catch as follows:</p>
  
  <pre><code>@RestControllerAdvice
  public MyExceptionHandler {
      @ExceptionHandler(IOException.class)
      @ResponseStatus(HttpStatus.BAD_REQUEST)
      public Object io(HttpServletRequest req, Exception e) {
          return ...
      }
  
  
      @ExceptionHandler(Exception.class)
      public Object exception(HttpServletRequest req, Exception e) {
          MailService.send();
          Logger.logInSpecificWay();
  
          //TODO how to continue in the "normal" spring way with HandlerExceptionResolver?
      }
  }
  </code></pre>
  
  <p>Problem: if I add <code>@ExceptionHandler(Exception.class)</code> like that, I can catch those unhandled exceptions.</p>
  
  <p><strong>BUT</strong> I cannot let <code>spring</code> continue the normal workflow with <code>HandlerExceptionResolver</code> to create the response <code>ModelAndView</code> and set a HTTP STATUS code automatically.</p>
  
  <p>Eg if someone tries a <code>POST</code> on a <code>GET</code> method, spring by default would return a <code>405 Method not allowed</code>. But with an <code>@ExceptionHandler(Exception.class)</code> I would swallow this standard handling of spring...</p>
  
  <p>So how can I keep the default <code>HandlerExceptionResolver</code>, but still apply my custom logic?</p>