spring boot validation 两个值中必须有一个不为空
作者:互联网
@javax.validation.constraints.AssertTrue public class MyModel { private String value1; private String value2; @AssertTrue(message = "Values are invalid") private boolean isValid() { return value1 != null || value2 != null; } }
这样value1和value2不能都为空。
标签:AssertTrue,null,String,spring,boot,private,value2,value1,值中 来源: https://www.cnblogs.com/ShengLiu/p/16581019.html