Spring validation中@NotNull、@NotEmpty、@NotBlank的区别
1. @NotEmpty
/** * Asserts that the annotated string,collection, map or array is not {**@code **null} or empty.
@author Emmanuel Bernard @author Hardy Ferentschik
***/
@Documented
@Constraint(validatedBy = { })
@Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER})
@Retention(RUNTIME)
@ReportAsSingleViolation
@NotNull
@Size(min = 1)
public @interface NotEmpty {
String message() default "{org.hibernate.validator.constraints.NotEmpty.message}";
Class<?>[] groups() default { };
} 2. @NotBlank
3. @NotNull
最后更新于