diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/annotation/InjectionMetadata.java b/spring-beans/src/main/java/org/springframework/beans/factory/annotation/InjectionMetadata.java index 1d1fbd77cb72..bd275ea52945 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/annotation/InjectionMetadata.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/annotation/InjectionMetadata.java @@ -153,6 +153,9 @@ public static InjectionMetadata forElements(Collection elements * @return {@code true} indicating a refresh, {@code false} otherwise */ public static boolean needsRefresh(@Nullable InjectionMetadata metadata, Class clazz) { + if (metadata == EMPTY) { + return false; + } return (metadata == null || metadata.targetClass != clazz); }