日常开发中,我们会对参数做一些校验,会使用注解来实现校验,没有通过的会返回相应的message。
1、@NotNull注解写在实体类字段上
需要在Controller层写上对应注解@Valid
2、@NotNull注解写在Controller层校验参数,需要在对应接口上加上@Validated注解
日常开发中,我们会对参数做一些校验,会使用注解来实现校验,没有通过的会返回相应的message。
1、@NotNull注解写在实体类字段上
需要在Controller层写上对应注解@Valid
2、@NotNull注解写在Controller层校验参数,需要在对应接口上加上@Validated注解