title: How to validate entity in Spring Boot console application?
body: <p>I have a Spring Boot console application that uses Spring Data. </p>
  
  <p>I have a simple jpa repository </p>
  
  <pre class="lang-java prettyprint-override"><code>public interface MyRepository extends JpaRepository&lt;MyEntity, Integer&gt; {
  }
  </code></pre>
  
  <p>and an entity defined like this</p>
  
  <pre class="lang-java prettyprint-override"><code>import javax.validation.constraints.Min;
  // ....
  
  @Entity
  @Table(schema = "mySchema", name = "myTable")
  public class MyEntity {
      // ...
      @Column(nullable = false)
      @Min(100)
      private Integer group;
      // ...
  }
  </code></pre>
  
  <p>When I save this entity </p>
  
  <pre class="lang-java prettyprint-override"><code>myRepository.save(myEntity);
  </code></pre>
  
  <p>pom:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&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;2.1.8.RELEASE&lt;/version&gt;
  &lt;/parent&gt;
  
  &lt;dependencies&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;/dependency&gt;
     &lt;dependency&gt;
        &lt;groupId&gt;javax.validation&lt;/groupId&gt;
        &lt;artifactId&gt;validation-api&lt;/artifactId&gt;
        &lt;version&gt;2.0.1.Final&lt;/version&gt;
     &lt;/dependency&gt;
     &lt;dependency&gt;
        &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
        &lt;artifactId&gt;hibernate-validator&lt;/artifactId&gt;
        &lt;version&gt;6.1.0.Final&lt;/version&gt;
     &lt;/dependency&gt;
  &lt;/dependencies&gt;
  </code></pre>
  
  <p>I expect to see a validation error because <code>group</code> is <code>0</code> but I don't see any issue and at the database the value of a newly added row is <code>0</code>. What else do I need to do to enable validation? </p>