Can't believe that any data coming from the front end must not trust any data that comes from the front end. Never trust any data from the front end.@JsonFormat time must be in the specified format (here is the format of the receive parameter, not the data to be formatted)
@Null must be empty @NOtNUll cannot be empty @AssertTrue The Boolean value must be True @AssertFalse The Boolean value must be false @Past Time is the past time (for example, now is 2018-08-12 15:43:23, if the value passed after this time error) @Feauture time is the future time @NotBlank string cannot be null, and the length is greater than 0 @ The email string must be a mailbox @NotEmpty string must be non-empty @Min (10) number must be greater than or equal to @Max (20) number must be less than or equal to @Size (Min=1, max=10) The element range is 1-10 (can be string, array, collection, MAP, etc.) @Length (Min=1, max=10) string length range between 1-10 @Pattern (regexp = "0[0123]") can only be 00 or 01 or 02 or 03
@Valid cascading annotations (if the current property is a JavaBean, the fields inside the bean are also validated)
Note: When the controller layer method receives parameters, the @Valid annotations are used to indicate that the parameters of the current method need to be validated
Each validation note can be added with the message property, prompting the user when the validation failsExample:
// Verify Mailbox
@Email (message= "entered mailbox format is incorrect")private String concatemail; // images This List cannot be null, but each Image is hard to say, see @Valid cascading validation rules @NotNull Private list< @Valid image> images;
// list length is at least 1, cannot be null, each element (String) cannot be null, minimum length @NotNull @size (min=1) Private list< @Size (min=10) @NotNull string> list;
Springboot Data validation