From dbdd6eca60acfbf7cee4f3ee18caf58231e3402c Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Tue, 21 Jul 2009 14:35:42 +0000 Subject: [PATCH] AnnotationUtils.getAnnotation generally supports meta-annotation lookup --- .../core/annotation/AnnotationUtils.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/org.springframework.core/src/main/java/org/springframework/core/annotation/AnnotationUtils.java b/org.springframework.core/src/main/java/org/springframework/core/annotation/AnnotationUtils.java index 484ce377e78..f67071365b2 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/annotation/AnnotationUtils.java +++ b/org.springframework.core/src/main/java/org/springframework/core/annotation/AnnotationUtils.java @@ -75,7 +75,17 @@ public abstract class AnnotationUtils { * @see org.springframework.core.BridgeMethodResolver#findBridgedMethod(Method) */ public static A getAnnotation(Method method, Class annotationType) { - return BridgeMethodResolver.findBridgedMethod(method).getAnnotation(annotationType); + Method resolvedMethod = BridgeMethodResolver.findBridgedMethod(method); + A ann = resolvedMethod.getAnnotation(annotationType); + if (ann == null) { + for (Annotation metaAnn : resolvedMethod.getAnnotations()) { + ann = metaAnn.annotationType().getAnnotation(annotationType); + if (ann != null) { + break; + } + } + } + return ann; } /**