From cf52e525ae8e009dbf8a1e5a7a0535e06aa84dcf 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 git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@1581 50f2f4bb-b051-0410-bef5-90022cba6387 --- .../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; } /**