From 9db4118180479cc0e26cd0824279de580e07f417 Mon Sep 17 00:00:00 2001 From: GungnirLaevatain <547992357@qq.com> Date: Tue, 3 Sep 2019 15:25:04 +0800 Subject: [PATCH] Fix DefaultListableBeanFactory#copyConfigurationFrom Prior to this commit, the copyConfigurationFrom(ConfigurableBeanFactory) method in DefaultListableBeanFactory cloned its own AutowireCandidateResolver type instead of the resolver type from the supplied ConfigurableBeanFactory. This commit fixes that by cloning the resolver type from the supplied ConfigurableBeanFactory. Closes gh-23569 --- .../beans/factory/support/DefaultListableBeanFactory.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java index 49c004cd89..c57372948b 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java @@ -321,7 +321,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto this.allowEagerClassLoading = otherListableFactory.allowEagerClassLoading; this.dependencyComparator = otherListableFactory.dependencyComparator; // A clone of the AutowireCandidateResolver since it is potentially BeanFactoryAware... - setAutowireCandidateResolver(BeanUtils.instantiateClass(getAutowireCandidateResolver().getClass())); + setAutowireCandidateResolver(BeanUtils.instantiateClass(otherListableFactory.getAutowireCandidateResolver().getClass())); // Make resolvable dependencies (e.g. ResourceLoader) available here as well... this.resolvableDependencies.putAll(otherListableFactory.resolvableDependencies); }