title: Spring boot, how to use @Valid with List<T>
body: <p>I am trying to put validation to a Spring Boot project. So I put <code>@NotNull</code> annotation to Entity fields. In controller I check it like this:</p>
  
  <pre><code>@RequestMapping(value="", method = RequestMethod.POST)
  public DataResponse add(@RequestBody @Valid Status status, BindingResult bindingResult) {
      if(bindingResult.hasErrors()) {
          return new DataResponse(false, bindingResult.toString());
      }
  
      statusService.add(status);
  
      return  new DataResponse(true, "");
  }
  </code></pre>
  
  <p>This works. But when I make it with input <code>List&lt;Status&gt; statuses</code>, it doesn't work.</p>
  
  <pre><code>@RequestMapping(value="/bulk", method = RequestMethod.POST)
  public List&lt;DataResponse&gt; bulkAdd(@RequestBody @Valid List&lt;Status&gt; statuses, BindingResult bindingResult) {
      // some code here
  }
  </code></pre>
  
  <p>Basically, what I want is to apply validation check like in the add method to each Status object in the requestbody list. So, the sender will now which objects have fault and which has not.</p>
  
  <p>How can I do this in a simple, fast way?</p>