title: @ExceptionHandler + @ResponseStatus
body: <p>I am handling my controlled exceptions using the following code:</p>
  
  <pre><code>  @ExceptionHandler(MyException.class)
         @ResponseStatus(HttpStatus.NOT_FOUND)
         public ModelAndView handleMyException(MyException e) {
            ModelAndView mav = new ModelAndView(ERROR_PAGE);
            (...)
            return mav;
         }
  </code></pre>
  
  <p>That is, I want to both use custom views for different errors AND use response status code for the HTTP response.</p>
  
  <p>At the same time, for pure 404 I have the following config in web.xml</p>
  
  <pre><code>&lt;error-page&gt;
          &lt;error-code&gt;404&lt;/error-code&gt;
          &lt;location&gt;/404&lt;/location&gt;
      &lt;/error-page&gt;
  
      &lt;error-page&gt;
          &lt;error-code&gt;400&lt;/error-code&gt;
          &lt;location&gt;/400&lt;/location&gt;
      &lt;/error-page&gt;
  </code></pre>
  
  <p>Which takes to a 404 specific view.</p>
  
  <p>The problem is that when a <code>NOT_FOUND</code> is thrown from my <code>@ExceptionHandled</code> method, it is not showing my custom view, debugging shows that execution actually goes through the <code>handleMyException</code> method, but after it's done it also goes through the method that maps the <code>/404</code> in web.xml, and that is the view that gets shown.</p>
  
  <p>Also if I throw a different Response Code, I get the default behavior on Exceptions, instead of my custom view.</p>