Spring Validator
Validator接口
ValidationUtils工具类
errorCode[.object.property]
@initBinder
JSR-303
一次进行一个域验证,不通过立即停止返回。不是一次性全部验证完后把不通过的全部反馈出来。
| Constraint | Description | Example |
|---|---|---|
| @AssertFalse | ||
| @AssertTrue | ||
| @DecimalMax | ||
| @DecimalMin | ||
| @Digits | ||
| @Future | ||
| @Max | ||
| @Min | ||
| @NotNull | ||
| @Null | ||
| @Past | ||
| @Pattern | ||
| @Size |
每一个constaint都有默认错误消息描述,也可以自定义覆盖,key格式:constraint[.object].property