javax.validation.NotBlank missing validator

老子叫甜甜 提交于 2019-12-04 04:29:35

The problem is in the version you are using then. You need to update to 6.0.x series. With the current latest been 6.0.9. Note that the groupId is changed to org.hibernate.validator.

<dependency>
    <groupId>org.hibernate.validator</groupId>
    <artifactId>hibernate-validator</artifactId>
    <version>6.0.9.Final</version>
</dependency>

the javax.validation.constraints.NotBlankis part of Bean Validation 2.0 and validator for it is not present in 5.3 series.

as baeldung.com say Per the JSR 380 specification, the validation-api dependency contains the standard validation APIs:

<dependency>
  <groupId>javax.validation</groupId>
   <artifactId>validation-api</artifactId>
<version>2.0.0.Final</version>

Hibernate Validator is the reference implementation of the validation API. To use it, we must add the following dependencies:

<dependency>
   <groupId>org.hibernate.validator</groupId>
   <artifactId>hibernate-validator</artifactId>
<version>6.0.2.Final</version>

<dependency>
<groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator-annotation-processor</artifactId>
<version>6.0.2.Final</version></dependency>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!