title: Why not @Valid trigger the validation with hibernate validator ?
body: <p>I am trying to validate a incoming Json request when it is getting bind in Spring Boot controller with <code>Hibernate- validator</code>. Here is my simple Boot application</p>
  
  <pre><code>@SpringBootApplication
  @RestController
  public class ValidationTestApplication {
  
  private static final Logger logger = LoggerFactory.getLogger(ValidationTestApplication.class);
  
  public static void main(String[] args) {
      SpringApplication.run(ValidationTestApplication.class, args);
  }
  
  @PostMapping
  public ResponseEntity&lt;Node&gt; postController(@Valid @RequestBody Node node, BindingResult result) {
      logger.info("Hit in post controller");
      if (result.hasErrors()) {
          logger.error("Found Error !!!!");
          result.getAllErrors().forEach(i -&gt; logger.error(i.toString()));
          return ResponseEntity.badRequest().body(node);
      }
      return ResponseEntity.ok(node);
  }
  static class Node {
  
      @NotBlank
      String name;
      int age;
      // ... default, all args constructor
      // ... getters and setters. 
  
  }
  }
  </code></pre>
  
  <p>I have mark the <code>name</code> property <code>NotBlank</code> so that I am accepting that if blank value assign in <code>name</code> field I will get bad request response.</p>
  
  <p>Here is the Json with that I am testing</p>
  
  <pre><code>{
    "name":"",
    "age":23
  }
  </code></pre>
  
  <p>But I am not getting any error. I suppose it is not triggering the validation whatsoever. What part I am missing here ? </p>
  
  <p>I have also provide my <code>POM</code> if you find it is useful.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project xmlns="http://maven.apache.org/POM/4.0.0" 
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
  http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
  &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
  &lt;groupId&gt;com.example.seal&lt;/groupId&gt;
  &lt;artifactId&gt;validation-test&lt;/artifactId&gt;
  &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
  &lt;packaging&gt;jar&lt;/packaging&gt;
  
  &lt;name&gt;validation-test&lt;/name&gt;
  &lt;description&gt;Demo project for Spring Boot&lt;/description&gt;
  
  &lt;parent&gt;
      &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
      &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
      &lt;version&gt;1.5.8.RELEASE&lt;/version&gt;
      &lt;relativePath/&gt; &lt;!-- lookup parent from repository --&gt;
  &lt;/parent&gt;
  
  &lt;properties&gt;
      &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
      &lt;project.reporting.outputEncoding&gt;UTF-8&lt;/project.reporting.outputEncoding&gt;
      &lt;java.version&gt;1.8&lt;/java.version&gt;
  &lt;/properties&gt;
  
  &lt;dependencies&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-web&lt;/artifactId&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
  
      &lt;!-- https://mvnrepository.com/artifact/org.projectlombok/lombok-maven --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.projectlombok&lt;/groupId&gt;
          &lt;artifactId&gt;lombok-maven&lt;/artifactId&gt;
          &lt;version&gt;1.16.18.1&lt;/version&gt;
      &lt;/dependency&gt;
  
  &lt;/dependencies&gt;
  
  &lt;build&gt;
      &lt;plugins&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
  &lt;/build&gt;
  </code></pre>
  
  <p></p>