spring HibernateValidator 验证 子类不起作用,在要验证的子类前加上@Valid即可。
public class UserInfo {
private int Id;
@Valid
private AccontInfo accountInfo;
@NotEmpty(message="{Title.FirstName}{Validator.CanNotBeEmpty}")
private String FirstName;
private String LastName;
@Pattern(regexp="/^1[0-9]{10}$/",message="{Title.PhoneNo} {Validator.ErrorFormate}")
private String PhoneNo;
private int Gender;