Verify the difference between annotations

1.@NotNull: cannot be null, but can be an empty string

2.@NotEmpty: cannot be null, and the length must be greater than 0

3.@NotBlank: Can only be used on String, cannot be null, cannot be an empty string (remove the leading and trailing spaces), and after calling trim(), the length must be greater than 0

4.@length(min=**, max=**): set the minimum length and maximum length

5.@Email: Verify email format

Guess you like

Origin blog.csdn.net/D_J1224/article/details/107529772