springmvc参数校验:@NotEmpty、@NotBlank和@NotNull

springmvc中基本的非空校验

@NotEmpty

org.hibernate.validator.constraints.NotEmpty

@NotNull

@ Size( min=1)
@ Target( value={ ANNOTATION_TYPE, CONSTRUCTOR, FIELD, METHOD, PARAMETER})

@Retention(value=RUNTIME)

@NotBlank

org.hibernate.validator.constraints.NotBlank

@NotNull
@Target(value={ANNOTATION_TYPE,CONSTRUCTOR, FIELD,METHOD, PARAMETER})
@Retention(value=RUNTIME)

@NotNull

javax.validation.constraints.NotNull

@Target(value={ANNOTATION_TYPE,CONSTRUCTOR, FIELD,METHOD, PARAMETER})
@Retention(value=RUNTIME)

The annotated element must not be null. Accepts any type.

你可能感兴趣的:(springmvc)