javax.validation.UnexpectedTypeException: No validator could be found for type: java.lang.Integer
错误来源如下
@NotEmpty(message="接收人类型不能够为空")
public Integer getRecievetype() {
return this.recievetype;
}
正确的写法应为
@NotNull(message="接收人类型不能够为空")
public Integer getRecievetype() {
return this.recievetype;
}
在网上找了一下,找到一个博文,觉得可以记录下来,如下:
@NotNull、@NotEmpty、@NotBlank 三者的区别
@NotEmpty 用在集合类上面@NotBlank 用在String上面
@NotNull 用在基本类型上