@Data
public class LoginDTO implements Serializable {
@NotBlank(message = "用户名不能为空")
@Length(min = 5, max = 18, message = "用户名长度不正确!")
private String username;
@NotBlank(message = "密码不能为空")
@Length(min = 5, max = 18, message = "密码长度不正确!")
private String password;
}
比如这个,NotBlank未通过就不校验Length,可以实现吗?