@@ -402,7 +402,9 @@ public static AnnotationAttributes getMergedAnnotationAttributes(AnnotatedElemen
402
402
*/
403
403
public static <A extends Annotation > A findMergedAnnotation (AnnotatedElement element , Class <A > annotationType ) {
404
404
Assert .notNull (annotationType , "annotationType must not be null" );
405
- return findMergedAnnotation (element , annotationType .getName ());
405
+ AnnotationAttributes attributes = findMergedAnnotationAttributes (element , annotationType , false , false );
406
+ return (attributes != null ?
407
+ AnnotationUtils .synthesizeAnnotation (attributes , annotationType , element ) : null );
406
408
}
407
409
408
410
/**
@@ -423,7 +425,9 @@ public static <A extends Annotation> A findMergedAnnotation(AnnotatedElement ele
423
425
* @see #findMergedAnnotation(AnnotatedElement, Class)
424
426
* @see #findMergedAnnotationAttributes(AnnotatedElement, String, boolean, boolean)
425
427
* @see AnnotationUtils#synthesizeAnnotation(Map, Class, AnnotatedElement)
428
+ * @deprecated As of Spring Framework 4.2.3, use {@link #findMergedAnnotation(AnnotatedElement, Class)} instead.
426
429
*/
430
+ @ Deprecated
427
431
@ SuppressWarnings ("unchecked" )
428
432
public static <A extends Annotation > A findMergedAnnotation (AnnotatedElement element , String annotationName ) {
429
433
AnnotationAttributes attributes = findMergedAnnotationAttributes (element , annotationName , false , false );
@@ -459,13 +463,11 @@ public static <A extends Annotation> A findMergedAnnotation(AnnotatedElement ele
459
463
* @since 4.2
460
464
* @see #findMergedAnnotation(AnnotatedElement, Class)
461
465
* @see #getMergedAnnotationAttributes(AnnotatedElement, String, boolean, boolean)
462
- * @deprecated as of 4.2.3; use {@link #findMergedAnnotation(AnnotatedElement, Class)} instead
463
466
*/
464
- @ Deprecated
465
467
public static AnnotationAttributes findMergedAnnotationAttributes (AnnotatedElement element ,
466
468
Class <? extends Annotation > annotationType , boolean classValuesAsString , boolean nestedAnnotationsAsMap ) {
467
469
468
- AnnotationAttributes attributes = searchWithFindSemantics (element , annotationType , null ,
470
+ AnnotationAttributes attributes = searchWithFindSemantics (element , annotationType , annotationType . getName () ,
469
471
new MergedAnnotationAttributesProcessor (annotationType , null , classValuesAsString , nestedAnnotationsAsMap ));
470
472
AnnotationUtils .postProcessAnnotationAttributes (element , attributes , classValuesAsString , nestedAnnotationsAsMap );
471
473
return attributes ;
0 commit comments