본문 바로가기

Spring & SpringBoot

[SpringBoot Error] No validator could be found for constraint 'javax.validation.constraints.NotBlank' validating type 'java.lang.Integer' 에러 해결

@NotBlank와 @NotEmpty 어노테이션은 문자열(String) 필드에만 적용가능하고, Integer 필드에는 @NotNull을 사용해야 한다!

 

⛔ 오류메세지

javax.validation.UnexpectedTypeException: HV000030: No validator could be found for constraint 'javax.validation.constraints.NotBlank' validating type 'java.lang.Integer'.

 

참고

https://stackoverflow.com/questions/5982741/validation-error-no-validator-could-be-found-for-type-java-lang-integer

 

Validation error: "No validator could be found for type: java.lang.Integer"

I am working on a project with Spring why do I keep getting the following error? javax.validation.UnexpectedTypeException: No validator could be found for type: java.lang.Integer Here is my code:

stackoverflow.com