he specified annotation javaxvalidationconstraintsNotBlank defines no attribute groups
This error message means that the annotation javax.validation.constraints.NotBlank does not have an attribute called 'groups'. The 'groups' attribute is used to specify the validation group(s) to which the constraint should be applied.
This error typically occurs when you try to use the 'groups' attribute with the @NotBlank annotation. To resolve this error, you can either remove the 'groups' attribute or use a different validation annotation that supports the 'groups' attribute.
For example, you can use the @NotEmpty annotation instead of @NotBlank if you need to apply validation groups. The @NotEmpty annotation is similar to @NotBlank, but it also allows empty strings.
Here's an example of how to use the @NotEmpty annotation with validation groups:
@NotEmpty(message = "Name cannot be empty", groups = {ValidationGroup.class})
private String name;
In this example, the validation group ValidationGroup is specified using the 'groups' attribute. You can create multiple validation groups and apply them to different fields as needed.
原文地址: http://www.cveoy.top/t/topic/KVe 著作权归作者所有。请勿转载和采集!