【Bug】No validator… javax.validation.constraints.NotBlank validating type java.lang.Integer
wx63ec8c81ec2c9
【Bug】No validator… javax.validation.constraints.NotBlank validating type java.lang.Integer
经检查,是因为在 Integer 类型的字段上加了@NotBlank的校验注解,而该注解只能用于字符串类型,因此报类型不匹配异常
@NotBlank(message = "整季量不能为空")
private Integer totalSeasonNum;
解决方法:用其@NotNull注解代替 Integer类型字段的校验
No validator could be found for constraint ‘javax.validation.constraints.NotBlank‘ validating type
这是因为@NotBlank是validation-api 2.x才有的。hibernate-validator 6.x 依赖的是validation-api 2.x。所以排除项目中hibernate-validator 6.x 以下的依赖。
Validation异常:No validator could be found for constraint '.....' validating type 'java.lang.Integer'.
javax.validation.UnexpectedTypeException: HV000030: No validator could be found for constraint 'javax.validation.constraints.Pattern' validatin
javax.validation.UnexpectedTypeException: HV000030: No validator could be found for type: java.lang
1、错误描述 2016-05-05 15:15:57,889 [http-8080-exec-5] DEBUG enter cache javax.validation.UnexpectedTypeExcep...
2.完美解决java.lang.ClassCastException: class java.lang.Integer cannot be cast to class java.lang.Long
3.机械工程师求职
4.已解决ValueError: not enough values to unpack (expected 2, got 1)
5.调节心态的十种做法