Annotation Interface ValidateWith
Specifies validation groups to apply when validating the annotated class.
This annotation can be placed on payload classes (such as updates or commands) or on any class
that is validated manually using ValidationUtils
.
When present, only the specified validation groups will be used. If no groups are defined
or if the annotation is missing altogether, validation is performed using the default group
(Default
).
Example:
@ValidateWith(AdminChecks.class)
public class ApproveApplication {
@NotNull(groups = AdminChecks.class)
private String approvalNote;
}
This allows you to tailor validation rules depending on context, such as admin-specific checks, creation vs. update flows, or conditional enforcement.
- See Also:
-
Required Element Summary
Required Elements
-
Element Details
-
value
Class<?>[] valueOne or more validation groups to include when validating this class.- Returns:
- the groups to use during validation
-