title: Spring validation for list of nested class
body: <p>I have implemented my validation for list of custom class as mention in this <a href="https://stackoverflow.com/questions/12680730/validate-a-list-of-nested-objects-with-spring-validator">post</a>. For reference here my code looks like</p>
  
  <pre><code>class TopDtoForm {
    @NotEmpty
    private String topVar;
    private List&lt;DownDto&gt; downVarList;
    //getter and setter
  }
  
  class DownDto {
    private Long id;
    private String name;
    //getter and setter
  }
  
  @Component
  public class TopDtoFormValidator implements Validator {
    @Override
    public boolean supports(Class&lt;?&gt; clazz) {
      return TopDtoForm.class.equals(clazz);
    }
  
    @Override
    public void validate(Object target, Errors errors) {
      TopDtoForm topDtoForm = (TopDtoForm) target;
      for(int index=0; index&lt;topDtoForm.getDownVarList().size(); index++) {
          DownDto downDto = topDtoForm.getDownVarList().get(index);
          if(downDto.getName().isEmpty()) {
              errors.rejectValue("downVarList[" + index + "].name", "name.empty");
          }
      }
    }
  }
  </code></pre>
  
  <p>So even I send empty name binding result has 0 error. I tested with topVar and it is working fine. My question is do I have to do any other configuration to say use this validator? </p>
  
  <p>Thanks</p>