【Spring Boot】3.javax.validations.Unxpectedypectedypeption:No validator could be found for contraint
注を使う時に上のエラーが発生しました。@NotNull、@NotEmptyと@NotBlankの違いに注意してください。
@NotBlankはStringに使います。
@NotNullは基本タイプに使います。
基本タイプでNotEmptyやNotBlankを使うと上のエラーが発生します。
@Data
public class SensitiveWord {
@JSONField(serialize = false)
private Long id;
/**
*
*/
private Long uuid;
/**
*
*/
@NotNull(message = " ",groups = {AddGroup.class})
private Long sinListId;
/**
*
*/
@NotBlank(message = " ",groups = {AddGroup.class})
private String sinName;
/**
* :
* 0:
* 1:
* 2:
* 3:...
*/
@NotNull(message = " ",groups = {AddGroup.class})
private Integer type;
/**
*
*/
private String description;
/**
*
*/
private String note;
/**
*
* 0: 1:
*/
private Integer state;
/**
*
* 1: 0:
*/
private Integer isDeleted;
/**
*
*/
private Long createBy;
/**
*
*/
private Timestamp createTime;
/**
*
*/
private Long updateBy;
/**
*
*/
private Timestamp updateTime;
}
@NotEmptyは集合類に使います。@NotBlankはStringに使います。
@NotNullは基本タイプに使います。
基本タイプでNotEmptyやNotBlankを使うと上のエラーが発生します。