title: Spring MVC @ExceptionHandler method in controller never being invoked
body: <p>I have a Spring MVC controller with some simple REST service requests.  I would like to add some error handling when specific exceptions are thrown from my services, but I cannot get a handler method annotated with @ExceptionHandler to actually ever be called.  Here is one service I am deliberately throwing an exception to try and get my handler method to take over.  The handler method is never invoked and Spring just returns a 500 error to the calling client.  Do you have any ideas on what I'm doing wrong?</p>
  
  <pre><code>@ExceptionHandler(IOException.class)
  public ModelAndView handleIOException(IOException ex, HttpServletRequest request, HttpServletResponse response) {
      response.sendError(HttpServletResponse.SC_FORBIDDEN);
      System.out.println("It worked!");
      return new ModelAndView();
  }
  
  @RequestMapping(value = "/json/remove-service/{id}", method = RequestMethod.DELETE)
  public void remove(@PathVariable("id") Long id) throws IOException {
      throw new IOException("The handler should take over from here!");
  }
  </code></pre>