title: Spring MVC - @ init binder method not called
body: <p>Hi this is my controller</p>
  
  <pre><code>@RequestMapping(value="/home", method = RequestMethod.POST)
  public String homeSubmit(@Valid LoginForm loginForm , BindingResult bindResult){
  
      if(bindResult.hasErrors() ||  bindResult.hasFieldErrors() ){
          return "home";
      }else{
          return "Success";
      }
  }
  
  @InitBinder("loginForm")
  protected void initBinder(WebDataBinder binder) {
      binder.setValidator(new LoginFormValidator());
  }
  </code></pre>
  
  <p>following is my validator</p>
  
  <pre><code>public class LoginFormValidator implements Validator {
  
      public boolean supports(Class&lt;?&gt; classz) {
          return LoginForm.class.equals(classz); 
      }
  
      public void validate(Object target, Errors arg1) {
          System.out.println("inside validate method validator");
          LoginForm loginForm = (LoginForm) target;
          if(! loginForm.getUserName().equalsIgnoreCase("xxx")  ){
              arg1.rejectValue("userName","Invalid Data");
          }
          if(! loginForm.getPassword().equalsIgnoreCase("yyy")){
              arg1.rejectValue("password","Invalid Data");
          }
      }
  }
  </code></pre>
  
  <p>Problem is my validator is not all getting called.evertime the conditions <code>bindResult.hasErrors() ||  bindResult.hasFieldErrors()</code>  is <code>false</code>.I also tried debugging..It is not all getting called</p>