@Pattern不能用在Integer和Long上 今天在项目中Long的字段上加了@Pattern,结果报了这个错 HV000030: No validator could be found for constraint 'javax.validation.constraints.Pattern' validating type 'java.lang.Long' 因为java中的正则是针对字符串的,只有String才有Patter相关的方法 如果想进行正则校验,请使用String类型,不要使用Long, Integer这两张类型