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 a4afbb9b083..488e3375c06 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 @@ -133,6 +133,14 @@ import org.springframework.util.Assert; * please use standard Java reflection or Spring's {@link AnnotationUtils} * for simple annotation retrieval purposes. * + *
WARNING: If an annotation cannot be loaded because one of + * its attributes references a {@link Class} or {@link Enum} + * {@linkplain TypeNotPresentException that is not present in the classpath}, that + * annotation will not be accessible via the {@code MergedAnnotations} API. + * To assist with diagnosing such scenarios, you can set the log level for + * {@code "org.springframework.core.annotation.MergedAnnotation"} to {@code DEBUG}, + * {@code INFO}, or {@code WARN}. + * @author Phillip Webb * @author Sam Brannen * @since 5.2 diff --git a/spring-core/src/main/java/org/springframework/core/type/AnnotatedTypeMetadata.java b/spring-core/src/main/java/org/springframework/core/type/AnnotatedTypeMetadata.java index da990ff91f3..4ce047f260d 100644 --- a/spring-core/src/main/java/org/springframework/core/type/AnnotatedTypeMetadata.java +++ b/spring-core/src/main/java/org/springframework/core/type/AnnotatedTypeMetadata.java @@ -37,11 +37,19 @@ import org.springframework.core.annotation.MergedAnnotations; import org.springframework.util.MultiValueMap; /** - * Defines access to the annotations of a specific type ({@link AnnotationMetadata class} - * or {@link MethodMetadata method}), in a form that does not necessarily require + * Defines access to the annotations on a specific {@link AnnotationMetadata class} + * or {@link MethodMetadata method}, in a form that does not necessarily require * class loading of the types being inspected. Note, however, that classes for * encountered annotations will be loaded. * + *
WARNING: If an annotation cannot be loaded because one of + * its attributes references a {@link Class} or {@link Enum} + * {@linkplain TypeNotPresentException that is not present in the classpath}, that + * annotation will not be accessible via the {@code AnnotatedTypeMetadata} API. + * To assist with diagnosing such scenarios, you can set the log level for + * {@code "org.springframework.core.annotation.MergedAnnotation"} to {@code DEBUG}, + * {@code INFO}, or {@code WARN}. + * * @author Juergen Hoeller * @author Mark Fisher * @author Mark Pollack diff --git a/spring-core/src/main/java/org/springframework/core/type/AnnotationMetadata.java b/spring-core/src/main/java/org/springframework/core/type/AnnotationMetadata.java index cf159cc4cac..6b5917a1f71 100644 --- a/spring-core/src/main/java/org/springframework/core/type/AnnotationMetadata.java +++ b/spring-core/src/main/java/org/springframework/core/type/AnnotationMetadata.java @@ -25,9 +25,17 @@ import org.springframework.core.annotation.MergedAnnotation; import org.springframework.core.annotation.MergedAnnotations; /** - * Interface that defines abstract access to the annotations of a specific + * Interface that defines abstract access to the annotations on a specific * class, in a form that does not require that class to be loaded yet. * + *
WARNING: If an annotation cannot be loaded because one of + * its attributes references a {@link Class} or {@link Enum} + * {@linkplain TypeNotPresentException that is not present in the classpath}, that + * annotation will not be accessible via the {@code AnnotationMetadata} API. + * To assist with diagnosing such scenarios, you can set the log level for + * {@code "org.springframework.core.annotation.MergedAnnotation"} to {@code DEBUG}, + * {@code INFO}, or {@code WARN}. + * * @author Juergen Hoeller * @author Mark Fisher * @author Phillip Webb diff --git a/spring-core/src/main/java/org/springframework/core/type/MethodMetadata.java b/spring-core/src/main/java/org/springframework/core/type/MethodMetadata.java index a62ed09dfe1..51800ce9871 100644 --- a/spring-core/src/main/java/org/springframework/core/type/MethodMetadata.java +++ b/spring-core/src/main/java/org/springframework/core/type/MethodMetadata.java @@ -19,9 +19,17 @@ package org.springframework.core.type; import java.lang.reflect.Method; /** - * Interface that defines abstract access to the annotations of a specific + * Interface that defines abstract access to the annotations on a specific * method, in a form that does not require that method's class to be loaded yet. * + *
WARNING: If an annotation cannot be loaded because one of + * its attributes references a {@link Class} or {@link Enum} + * {@linkplain TypeNotPresentException that is not present in the classpath}, + * that annotation will not be accessible via the {@code MethodMetadata} API. + * To assist with diagnosing such scenarios, you can set the log level for + * {@code "org.springframework.core.annotation.MergedAnnotation"} to {@code DEBUG}, + * {@code INFO}, or {@code WARN}. + * * @author Juergen Hoeller * @author Mark Pollack * @author Chris Beams