title: @RequestMapping MethodInterceptor aspect ignores @Validated annotation
body: <p>I have a strange problem with <code>MethodInterceptor</code> aspect and <code>@Validated</code> annotation. When I add the method interceptor to intercept all the methods annotated with <code>@RequestMapping</code>, the <code>@Validated</code> annotation does not work. When I remove it, it works fine again. I think, my interceptor overrides the <code>@Validated</code>. Is there are any way to do this as I don't want to perform validation in my interceptor, because it is meant for auditing stuff.</p>
  
  <p>Here is the validator:</p>
  
  <pre><code>@Component
  public class UserValidator implements Validator {
  
  @Override
  public void validate(Object target, Errors errors) {
            //validation stuff
        }
  }
  </code></pre>
  
  <p>The code of the controller:</p>
  
  <pre><code>@Controller
  @RequestMapping("/profile")
  public class UserProfileController {
  
      @Autowired
      private UserValidator userValidator;
  
      @InitBinder("userValidator")
      private void userValidatorInitBinder(WebDataBinder binder) {
          binder.setValidator(userValidator);
      }
  
      @RequestMapping(value = "/reg.do", method = RequestMethod.POST)
      public @ResponseBody RegisterResponse reg(HttpServletRequest httpServletRequest, @RequestBody @Validated CreateUserRequest createUserRequest) {
      }
  }
  </code></pre>
  
  <p>The Interceptor code:</p>
  
  <pre><code>@Aspect
  @Component
  public class MyInterceptor implements MethodInterceptor, Serializable {
  
      @Around("@annotation(org.springframework.web.bind.annotation.RequestMapping)")
      @Override
      public Object invoke(MethodInvocation invocation) throws Throwable {
  
          Object returnValue = null;
          final StopWatch stopWatch = new StopWatch();
          try {
             stopWatch.start();
             returnValue = invocation.proceed();
             return returnValue;
         } catch (Throwable ex) {
             stopStopwatch(stopWatch);
             throw ex;
         } finally {
             System.out.println(stopwatch);
  }
      }
  }
  </code></pre>
  
  <p>My environment is Spring MVC (3.2) with rest controllers (Jackson Mapper).</p>