[HV000030: No validator could be found for constraint 'javax.validation.constraints.NotEmpty' validating type 'java.lang.String'
I got a similiar error but ...Constraints.NotEmpty' validating type 'java.lang.Long'
It happened because I was using @NotEmpty
in a non-String field.
I solved it replacing @NotEmpty
with @Size(value=1, message= "whatever")
I have the same problem; my spring-boot-starter-web dependency includes a dependency on org.hibernate:hibernate-validator:5.3.6.Final but I. I added this exclusion to my POM and it's all all good now:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</dependencyManagement>
@NotBlank
: Checks that the annotated character sequence is not null and the trimmed length is greater than 0.@NotNull
: Checks whether the annotated element is not null nor empty.@NotEmpty
: Checks that the annotated value is not null
Before use the above annotation, have to think about how it works.
for further reading use this article : Read more article one Read more article two