title: Spring Validation - Programmatically bind to a Validator
body: <p>I am trying to use Spring validation to validate my model populated by Jackson converter.
  So I have a java class,   </p>
  
  <pre><code>class MyClass(){
      private String myString;
  }
  </code></pre>
  
  <p>This class is populated by Jackson and I have the instance in my Java code.
  Have also defined a validator class like,</p>
  
  <pre><code>class MyValidator implements Validator {
      public boolean supports(Class&lt;?&gt; clazz) {
          return MyClass.class.equals(clazz);
      }   
      public void validate(Object object, Errors errors) {
             //Validation logic here
      }
  }
  </code></pre>
  
  <p>Now what I wanted to do was to send the object to the validator and get the errors object, examine and proceed further. But, for calling </p>
  
  <pre><code>validate(Object object,Errors errors) 
  </code></pre>
  
  <p>I need an errors instance which I dont have. I cant use <code>BindingResult</code> or <code>Errors</code>. Please advise on how to proceed further.</p>