title: @Valid annotation is not working in spring boot
body: <p>Here is the scenario, a controller annotated with <code>@RestController</code> and a <code>PUT</code> method whose <code>@RequestBody</code> argument needs to be validated. I use <code>@Valid</code> annotation on the argument and <code>@NotNull</code>,<code>@Min</code> annotations on bean fields, but they are not working.</p>
  
  <p>Code is here:</p>
  
  <p>the Bean:</p>
  
  <pre><code>public class PurchaseWrapper {
    @DecimalMin(value = "0.00",message = "discount must be positive")
    @NotNull
    private BigDecimal discount;
    @NotNull
    private Long merchandiseId;
    @NotNull
    private Long addressId;
    @Min(1)
    @NotNull
    private Integer count;
  }
  </code></pre>
  
  <p>the Controller</p>
  
  <pre><code>@RestController
  @RequestMapping("merchandises")
  public class MerchandiseController {
  
  @RequestMapping(value = "purchase",method = RequestMethod.PUT)
  public ResponseEntity&lt;RestEntity&gt; purchase(@Valid @Validated @RequestBody PurchaseWrapper purchaseWrapper,
                                             @RequestParam String token){
      return new ResponseEntity&lt;&gt;(merchandiseService.purchase(purchaseWrapper,token),HttpStatus.OK);
  }
  
  @Autowired
  PurchaseWrapperValidator purchaseWrapperValidator;
  
  @InitBinder(value = "purchaseWrapper")
  protected void initBinder(WebDataBinder binder) {
      binder.setValidator(purchaseWrapperValidator);
  }
  }
  </code></pre>
  
  <p>The pom file:</p>
  
  <pre><code>    &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
      &lt;dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
          &lt;artifactId&gt;hibernate-validator&lt;/artifactId&gt;
      &lt;/dependency&gt;
  </code></pre>
  
  <p>I have no idea what's wrong here... And I guess it's the problem that I use <code>@Valid</code> and <code>@Validated</code> annotations both on the same argument. But even though I omit the <code>@Validated</code> annotation, the <code>@Valid</code> is still not working...</p>
  
  <p>Any ideas?</p>