title: GWT validation (JSR 303) SampleValidatorFactory
body: <p>I try to use bean validation in GWT. I follow this guide : 
  <a href="https://developers.google.com/web-toolkit/doc/latest/DevGuideValidation" rel="nofollow">https://developers.google.com/web-toolkit/doc/latest/DevGuideValidation</a></p>
  
  <p>At compile time, I have the following error :</p>
  
  <pre><code>ERROR: Could not load deferred binding result type 'com.google.gwt.sample.validation.client.SampleValidatorFactory'
  </code></pre>
  
  <p>I can make it working if I include this dependency:</p>
  
  <pre><code>&lt;dependency&gt;
    &lt;groupId&gt;com.googlecode.gwt-validation&lt;/groupId&gt;
    &lt;artifactId&gt;gwt-validation&lt;/artifactId&gt;
    &lt;version&gt;2.1&lt;/version&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>But I find it weird because this dependency is not mentionned in the guide. </p>
  
  <p><strong>Question</strong> : As GWT 2.5 is supposed to support bean validation, why do I need this additional library? What am I doing wrong?</p>
  
  <p>I am using GWT 2.5.0</p>
  
  <p>My pom.xml contains the following dependencies :</p>
  
  <pre><code>&lt;dependency&gt;
    &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
    &lt;artifactId&gt;hibernate-validator&lt;/artifactId&gt;
    &lt;version&gt;4.3.1.Final&lt;/version&gt;
    &lt;type&gt;jar&lt;/type&gt;
    &lt;classifier&gt;sources&lt;/classifier&gt;
  &lt;/dependency&gt;
  
  &lt;dependency&gt;
    &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
    &lt;artifactId&gt;hibernate-validator&lt;/artifactId&gt;
    &lt;version&gt;4.3.1.Final&lt;/version&gt;
    &lt;type&gt;jar&lt;/type&gt;
  &lt;/dependency&gt;
  
  &lt;dependency&gt;
    &lt;groupId&gt;javax.validation&lt;/groupId&gt;
    &lt;artifactId&gt;validation-api&lt;/artifactId&gt;
    &lt;version&gt;1.0.0.GA&lt;/version&gt;
    &lt;type&gt;jar&lt;/type&gt;
    &lt;classifier&gt;sources&lt;/classifier&gt;
  &lt;/dependency&gt;
  
  &lt;dependency&gt;
    &lt;groupId&gt;javax.validation&lt;/groupId&gt;
    &lt;artifactId&gt;validation-api&lt;/artifactId&gt;
    &lt;version&gt;1.0.0.GA&lt;/version&gt;
    &lt;type&gt;jar&lt;/type&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>and my gwt.xml contains the following lines :</p>
  
  <pre><code>&lt;inherits name="org.hibernate.validator.HibernateValidator" /&gt;
  &lt;replace-with
    class="com.google.gwt.sample.validation.client.SampleValidatorFactory"&gt;
    &lt;when-type-is class="javax.validation.ValidatorFactory" /&gt;
  &lt;/replace-with&gt;
  </code></pre>
  
  <p>In the code, I get the Validator in this way :</p>
  
  <pre><code>import javax.validation.Validator;
  ...
  private static final Validator VALIDATOR= Validation.buildDefaultValidatorFactory().getValidator();
  </code></pre>