diff --git a/spring-core/src/main/java/org/springframework/core/annotation/AnnotatedElementUtils.java b/spring-core/src/main/java/org/springframework/core/annotation/AnnotatedElementUtils.java
index 9560a8451c..3ac8672432 100644
--- a/spring-core/src/main/java/org/springframework/core/annotation/AnnotatedElementUtils.java
+++ b/spring-core/src/main/java/org/springframework/core/annotation/AnnotatedElementUtils.java
@@ -402,7 +402,9 @@ public class AnnotatedElementUtils {
*/
public static A findMergedAnnotation(AnnotatedElement element, Class annotationType) {
Assert.notNull(annotationType, "annotationType must not be null");
- return findMergedAnnotation(element, annotationType.getName());
+ AnnotationAttributes attributes = findMergedAnnotationAttributes(element, annotationType, false, false);
+ return (attributes != null ?
+ AnnotationUtils.synthesizeAnnotation(attributes, annotationType, element) : null);
}
/**
@@ -423,7 +425,9 @@ public class AnnotatedElementUtils {
* @see #findMergedAnnotation(AnnotatedElement, Class)
* @see #findMergedAnnotationAttributes(AnnotatedElement, String, boolean, boolean)
* @see AnnotationUtils#synthesizeAnnotation(Map, Class, AnnotatedElement)
+ * @deprecated As of Spring Framework 4.2.3, use {@link #findMergedAnnotation(AnnotatedElement, Class)} instead.
*/
+ @Deprecated
@SuppressWarnings("unchecked")
public static A findMergedAnnotation(AnnotatedElement element, String annotationName) {
AnnotationAttributes attributes = findMergedAnnotationAttributes(element, annotationName, false, false);
@@ -459,13 +463,11 @@ public class AnnotatedElementUtils {
* @since 4.2
* @see #findMergedAnnotation(AnnotatedElement, Class)
* @see #getMergedAnnotationAttributes(AnnotatedElement, String, boolean, boolean)
- * @deprecated as of 4.2.3; use {@link #findMergedAnnotation(AnnotatedElement, Class)} instead
*/
- @Deprecated
public static AnnotationAttributes findMergedAnnotationAttributes(AnnotatedElement element,
Class extends Annotation> annotationType, boolean classValuesAsString, boolean nestedAnnotationsAsMap) {
- AnnotationAttributes attributes = searchWithFindSemantics(element, annotationType, null,
+ AnnotationAttributes attributes = searchWithFindSemantics(element, annotationType, annotationType.getName(),
new MergedAnnotationAttributesProcessor(annotationType, null, classValuesAsString, nestedAnnotationsAsMap));
AnnotationUtils.postProcessAnnotationAttributes(element, attributes, classValuesAsString, nestedAnnotationsAsMap);
return attributes;