title: JSR-303 bean validation with Spring does not kick in
body: <p>I've configured a JSR-303 custom validator following what's given in the docs (<a href="http://docs.spring.io/spring/docs/4.0.x/spring-framework-reference/html/validation.html" rel="noreferrer">http://docs.spring.io/spring/docs/4.0.x/spring-framework-reference/html/validation.html</a>), complete with LocalValidatorFactoryBean and Hibernate validator on the classpath. However, my validator just refuses to kick in. I've put up a dirt simple test project here (<a href="https://github.com/abhijitsarkar/java/tree/master/spring-jsr-303" rel="noreferrer">https://github.com/abhijitsarkar/java/tree/master/spring-jsr-303</a>), along with a failing unit test. Should you decide to take a look, just clone it and run
  <code>gradlew clean test</code> from the root directory.
  I'm using Spring framework 4.0.2.RELEASE and Hibernate validator 5.0.3.Final.</p>
  
  <p>Method under validation:</p>
  
  <pre><code>public Coffee serve(@ValidOrder(Coffee.Blend.class) final String blend) {
  </code></pre>
  
  <p>ValidOrder annotation:</p>
  
  <pre><code>@Documented
  @Constraint(validatedBy = {OrderValidator.class})
  @Retention(RetentionPolicy.RUNTIME)
  @Target({ElementType.METHOD,
          ElementType.FIELD,
          ElementType.ANNOTATION_TYPE,
          ElementType.CONSTRUCTOR,
          ElementType.PARAMETER})
  @NotNull
  public @interface ValidOrder {
  </code></pre>
  
  <p>OrderValidator validator:</p>
  
  <pre><code>public class OrderValidator implements ConstraintValidator&lt;ValidOrder, String&gt; {
  </code></pre>
  
  <p>Spring config:</p>
  
  <pre><code>@Configuration
  @ComponentScan(basePackages = "name.abhijitsarkar.coffeehouse")
  @EnableAspectJAutoProxy
  public abstract class AppConfig {
  
      @Bean
      public LocalValidatorFactoryBean validator() {
          return new LocalValidatorFactoryBean();
      }
  }
  </code></pre>
  
  <p>Dependencies:</p>
  
  <pre><code>dependencies {
      compile(
              [group: 'javax.inject', name: 'javax.inject', version: injectApiVersion],
              [group: 'javax.validation', name: 'validation-api', version: beanValidationApiVersion],
              [group: 'javax.annotation', name: 'javax.annotation-api', version: annotationApiVersion],
              [group: 'org.springframework', name: 'spring-beans', version: springVersion],
              [group: 'org.springframework', name: 'spring-context', version: springVersion],
              [group: 'org.springframework', name: 'spring-aop', version: springVersion],
              [group: 'org.aspectj', name: 'aspectjrt', version: aspectjVersion]
      )
      runtime(
              [group: 'org.hibernate', name: 'hibernate-validator', version: hibernateValidatorVersion],
              [group: 'javax.el', name: 'javax.el-api', version: elVersion],
              [group: 'org.glassfish.web', name: 'javax.el', version: glassfishElVersion],
              [group: 'org.aspectj', name: 'aspectjweaver', version: aspectjVersion]
      )
  </code></pre>