mirror of
https://github.com/spring-projects/spring-framework
synced 2026-06-08 17:33:33 +00:00
Consistently find @Validated as a meta-annotation at arbitrary depths
Prior to this commit, ValidationAnnotationUtils looked up @Validated as a meta-annotation at arbitrary depths (e.g., when used as a meta-meta-annotation) in determineValidationGroups() but only as a "directly present" meta-annotation in determineValidationHints(). For consistency, this commit revises determineValidationHints() so that it finds @Validated as a meta-annotation at arbitrary depths as well. Closes gh-36274
This commit is contained in:
+4
-3
@@ -27,7 +27,8 @@ import org.springframework.core.annotation.AnnotationUtils;
|
||||
|
||||
/**
|
||||
* Utility class for handling validation annotations.
|
||||
* Mainly for internal use within the framework.
|
||||
*
|
||||
* <p>Mainly for internal use within the framework.
|
||||
*
|
||||
* @author Christoph Dreis
|
||||
* @author Juergen Hoeller
|
||||
@@ -41,7 +42,7 @@ public abstract class ValidationAnnotationUtils {
|
||||
|
||||
|
||||
/**
|
||||
* Determine any validation hints by the given annotation.
|
||||
* Determine any validation hints for the given annotation.
|
||||
* <p>This implementation checks for Spring's
|
||||
* {@link org.springframework.validation.annotation.Validated},
|
||||
* {@code @jakarta.validation.Valid}, and custom annotations whose
|
||||
@@ -62,7 +63,7 @@ public abstract class ValidationAnnotationUtils {
|
||||
return EMPTY_OBJECT_ARRAY;
|
||||
}
|
||||
// Meta presence of @Validated ?
|
||||
Validated validatedAnn = AnnotationUtils.getAnnotation(ann, Validated.class);
|
||||
Validated validatedAnn = AnnotationUtils.findAnnotation(annotationType, Validated.class);
|
||||
if (validatedAnn != null) {
|
||||
return validatedAnn.value();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user