javax.validation.constraints.NotEmpty
时间: 2023-10-02 09:10:05 浏览: 177
javax.validation.constraints.NotEmpty是一个用于验证字段不为空的约束注解。它可以应用于String、Collection、Map和数组等类型的字段上。被@NotEmpty注解修饰的字段不能为null且不能为空。\[3\]在引用\[2\]中的示例中,@NotEmpty(message = "ID不能为空")应用于List<String>类型的userIds字段,表示该字段不能为null且不能为空。因此,在创建的类对象中,如果userIds字段为null或者为空集合,就会出现"执行报错:No validator could be found for constraint 'javax.validation.constraints.NotEmpty' validating type 'java.lang.Long'. Check configuration for 'id'"的错误提示。\[1\]
#### 引用[.reference_title]
- *1* [No validator could be found for constraint ‘javax.validation.constraints.NotEmpty‘...报错解决](https://blog.csdn.net/qq_40816795/article/details/127109993)[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^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* [validation校验包常用校验注解@NotEmpty,@NotBlank,@NotNull等注解](https://blog.csdn.net/Ying_ph/article/details/125908693)[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^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
- *3* [javax.validation.constraints中@NotEmpty,@NotNull,@NotBlank的区别](https://blog.csdn.net/m0_51176516/article/details/117456403)[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^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文