我有一个 User
类,如下所示,我正在尝试强制验证,但我得到了:
error cannot find symbol symbol: class Size
我的类(class)看起来像这样:
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
@Entity
public class User {
@Id
private long id;
@Size(min=1,max=18)
private int age;
// getters and setters
}
最佳答案
您缺少尺寸注释的导入。
import javax.validation.constraints.Size;
关于java - Spring Boot 类 Size 未找到 @Size(min=1,max=18),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39814300/