diff --git a/spring-core/src/main/java/org/springframework/core/annotation/MergedAnnotations.java b/spring-core/src/main/java/org/springframework/core/annotation/MergedAnnotations.java index ef25638c01f..81822f690ff 100644 --- a/spring-core/src/main/java/org/springframework/core/annotation/MergedAnnotations.java +++ b/spring-core/src/main/java/org/springframework/core/annotation/MergedAnnotations.java @@ -483,12 +483,18 @@ public interface MergedAnnotations extends Iterable *

This strategy is similar to {@link #TYPE_HIERARCHY} except that * {@linkplain Class#getEnclosingClass() enclosing classes} are also * searched. - *

Superclass annotations do not need to be meta-annotated with - * {@link Inherited @Inherited}. + *

Superclass and enclosing class annotations do not need to be + * meta-annotated with {@link Inherited @Inherited}. *

When searching a {@link Method} source, this strategy is identical * to {@link #TYPE_HIERARCHY}. + *

WARNING: This strategy searches recursively for + * annotations on the enclosing class for any source type, regardless + * whether the source type is an inner class, a {@code static} + * nested class, or a nested interface. Thus, it may find more annotations + * than you would expect. */ TYPE_HIERARCHY_AND_ENCLOSING_CLASSES + } }