title: Spring JSR303 validation doesn't work like described in Spring Documentation
body: <p>I tried implementing validation for my web application like described in section <a href="http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/ch05s07.html#validation.mvc.jsr303" rel="noreferrer">5.7.4.3</a> of the Spring 3.0 documentation:</p>
  
  <pre><code>&lt;bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"&gt;
      &lt;property name="webBindingInitializer"&gt;
          &lt;bean class="org.springframework.web.bind.support.ConfigurableWebBindingInitializer"&gt;
              &lt;property name="validator"&gt;
                  &lt;bean class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean" /&gt;
              &lt;/property&gt;
          &lt;/bean&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>I've added hibernate-validator as a dependency and everything looks OK, but starting my web app results in the following error:</p>
  
  <pre><code>org.springframework.beans.NotWritablePropertyException:
  Invalid property 'validator' of bean class
  [org.springframework.web.bind.support.ConfigurableWebBindingInitializer]:
  Bean property 'validator' is not writable or has an invalid setter method.
  Does the parameter type of the setter match the return type of the getter?
  </code></pre>
  
  <p>When looking at the API it's pretty obvious that something's wrong. <a href="http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/validation/beanvalidation/LocalValidatorFactoryBean.html" rel="noreferrer"><code>LocalValidatorFactoryBean</code></a> implements <code>javax.validation.Validator</code> while <a href="http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/web/bind/support/ConfigurableWebBindingInitializer.html#setValidator%28org.springframework.validation.Validator%29" rel="noreferrer"><code>ConfigurableWebBindingInitializer.setValidator()</code></a> expects a <code>org.springframework.validation.Validator</code>.</p>
  
  <p>Any solution for this?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>About <a href="http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/validation/beanvalidation/LocalValidatorFactoryBean.html" rel="noreferrer"><code>LocalValidatorFactoryBean</code></a>:</p>
  
  <blockquote>
    <p>This is the central class for <code>javax.validation</code> (JSR-303) setup in a Spring application context: It bootstraps a <code>javax.validation.ValidationFactory</code>  and exposes it through the Spring <code>Validator</code> interface as well as through the JSR-303 <code>Validator</code> interface and the <code>ValidatorFactory</code> interface itself.</p>
  </blockquote>
  
  <p>Like Alex Marshall stated below this is <strong>not</strong> the case. <code>LocalValidatorFactoryBean</code> only implements <code>javax.validation.Validator</code>.</p>
  
  <p><code>LocalValidatorFactoryBean</code> does extend <code>SpringValidatorAdapter</code> though, which implements  <code>org.springframework.validation.Validator</code>.</p>