title: Adding parameters to @ExceptionHandler for MethodArgumentNotValidException in Spring
body: <p>I have a Spring controller that validates incoming requests with hibernate validator.</p>
  
  <p>When the request is invalid,  <code>MethodArgumentNotValidException</code> is thrown by the validator. Would it be possible to add additional class as an argument to handler method for the exception?</p>
  
  <p>This is what i have:</p>
  
  <pre><code>@RequestMapping(value = "/...", method = RequestMethod.POST)
  @ResponseBody
  public Response handleCustomObject(@Valid @RequestBody CustomObject obj) {
    //..
  }
  
  
  @ExceptionHandler(MethodArgumentNotValidException.class)
  @ResponseBody
  public Response handleInvalidRequest(MethodArgumentNotValidException e) {
  
      return getMissingMandatoryParametersResponse(e);
  
      }
  }
  </code></pre>
  
  <p>And i would need something like example bellow, however this doesn't work:</p>
  
  <pre><code>@ExceptionHandler(MethodArgumentNotValidException.class)
  @ResponseBody
  public Response handleInvalidRequest(MethodArgumentNotValidException e, CustomObject obj) {
  
   // do something with CustomObject
  }
  </code></pre>