@NotNull(group)
时间: 2023-12-05 17:03:04 浏览: 85
spring @Validated 注解开发中使用group分组校验的实现
@NotNull注解可以通过配置group参数来指定在验证时生效的分组。例如,在User类中,配置了username字段的groups为TestNotNull.class,那么在使用@Validated注解时,指定了相同的分组(TestNotNull.class),只会判断username是否为空。而password因为没有配置相同的groups属性,所以不会被验证。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *3* [@NotNull 注解中groups 的用法](https://blog.csdn.net/xc_nostalgia/article/details/109644468)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"]
- *2* [@NotNull中groups的作用](https://blog.csdn.net/weixin_45676630/article/details/123423691)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文