title: Spring Boot JSR-303/349 configuration
body: <p>In my <code>Spring Boot 1.5.1</code> application I'm trying to configure support of JSR-303 / JSR-349 validation.</p>
  
  <p>I have added a following annotations <code>@NotNull @Size(min = 1)</code> to my method:</p>
  
  <pre><code>@Service
  @Transactional
  public class DecisionDaoImpl extends BaseDao implements DecisionDao {
  
      @Override
      public Decision create(@NotNull @Size(min = 1) String name, String description, String url, String imageUrl, Decision parentDecision, Tenant tenant, User user) {
          ...
      }
  
  }
  </code></pre>
  
  <p>I'm trying to invoke this method from my test, but it does not fail on the validation constraints.</p>
  
  <p>This is my test and configs:</p>
  
  <pre><code>@SpringBootTest(classes = { TestConfig.class, Neo4jTestConfig.class })
  @RunWith(SpringRunner.class)
  @Transactional
  public class TenantTest {
  
      @Test
      public void testCreateDecision() {
          User user1 = userService.createUser("test1", "test1", "test1@test.com", null, null);
          Tenant tenant1 = tenantDao.create("Tenant 1", "Tenant 1 description", false, user1);
  
          // the following line should fail on the validation constraint because name parameter is null but it doesn't
          final Decision rootDecision = decisionDao.create(null, "Root decision 1 description", null, tenant1, user1);
  
  ...
  
  
  @Configuration
  @ComponentScan("com.example")
  @SpringBootApplication(exclude={Neo4jDataAutoConfiguration.class})
  public class TestConfig {
  }
  </code></pre>
  
  <p>What am I doing wrong and how to configure JSR-303 there ?</p>
  
  <p><strong>UPDATED</strong></p>
  
  <p>I have added</p>
  
  <pre><code>public Decision create(@Valid @NotNull @Size(min = 1) String name, String description, Decision parentDecision, Tenant tenant, User author) {
  </code></pre>
  
  <p>but it still doesn't work</p>
  
  <p>I have added <code>@Validated</code> to my <code>DecisionDaoImpl</code> but it fails now with a following exception:</p>
  
  <pre><code>Caused by: org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'decisionDaoImpl': Bean with name 'decisionDaoImpl' has been injected into other beans [criterionGroupDaoImpl,characteristicGroupDaoImpl,tenantDaoImpl] in its raw version as part of a circular reference, but has eventually been wrapped. This means that said other beans do not use the final version of the bean. This is often the result of over-eager type matching - consider using 'getBeanNamesOfType' with the 'allowEagerInit' flag turned off, for example.
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:585)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
      at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
      at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:208)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066)
      at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:585)
      ... 43 common frames omitted
  </code></pre>
  
  <p>I have also added <code>@Lazy</code> annotation in a places where I'm autowiring my <code>DecisionDao</code> but right now my test fails with a following exception:</p>
  
  <pre><code>javax.validation.ConstraintDeclarationException: HV000151: A method overriding another method must not alter the parameter constraint configuration, but method public com.example.domain.model.entity.decision.Decision com.example.domain.dao.decision.DecisionDaoImpl.create(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.Long,java.lang.Long,com.example.domain.model.entity.user.User) changes the configuration of public abstract com.example.domain.model.entity.decision.Decision com.example.domain.dao.decision.DecisionDao.create(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.Long,java.lang.Long,com.example.domain.model.entity.user.User).
      at org.hibernate.validator.internal.metadata.aggregated.rule.OverridingMethodMustNotAlterParameterConstraints.apply(OverridingMethodMustNotAlterParameterConstraints.java:24)
      at org.hibernate.validator.internal.metadata.aggregated.ExecutableMetaData$Builder.assertCorrectnessOfConfiguration(ExecutableMetaData.java:456)
  </code></pre>