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 用在基本類型上