title: Spring Hibernate Validation @RequestBody
body: <p>Using Spring Boot 1.4 and Spring Data Rest/MVC I'm unable to get @Valid @RequestBody working. I have tried multiple versions of Hibernate Validator, declaring Validtor beans etc. No luck.</p>
  
  <pre><code>@BasePathAwareController
  @RestController
  public class TestRestController extends BaseController {
      @PostMapping("/pojo/save")
      public @ResponseBody ResponseEntity&lt;?&gt; upload(@Valid @RequestBody MyPojo pojo) {
       // Code here calling a repository.save. 
  }
  </code></pre>
  
  <p>MyPojo contains various validation annotations i.e. @Digits, @NotNull, etc. I actually see the validator exception when the repostiory.save method is called but Spring is not attempting any validation on the pojo. </p>
  
  <p>Here is the section of my POM including the spring dependencies:</p>
  
  <pre><code>        &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-data-rest&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-data-jpa&lt;/artifactId&gt;
              &lt;exclusions&gt;
                  &lt;exclusion&gt;
                      &lt;groupId&gt;org.apache.tomcat&lt;/groupId&gt;
                      &lt;artifactId&gt;tomcat-jdbc&lt;/artifactId&gt;
                  &lt;/exclusion&gt;
              &lt;/exclusions&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-mail&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-thymeleaf&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-security&lt;/artifactId&gt;
          &lt;/dependency&gt;
  </code></pre>
  
  <p>Any ideas would be appreciated. I've done a ton of searching and tried many different configurations without any luck.</p>
  
  <p><strong>Update</strong></p>
  
  <p>When attempting to save the entity to the database, that's when the validation errors occur. I receive the following error:</p>
  
  <pre><code>Caused by: javax.persistence.RollbackException: Error while committing the transaction
  Caused by: javax.validation.ConstraintViolationException: Validation failed for classes
  List of constraint violations:[
      ConstraintViolationImpl{interpolatedMessage='numeric value out of bounds (&lt;9 digits&gt;.&lt;3 digits&gt; expected)...
  </code></pre>