From 6f45a1ac0091c390eeaf53e654498f8df12b7ea3 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Wed, 25 Sep 2019 20:48:22 +0200 Subject: [PATCH] Fix DefaultListableBeanFactory#copyConfigurationFrom Closes gh-23569 --- .../beans/factory/support/DefaultListableBeanFactory.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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 d72840054e2..d072a9dfe82 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 @@ -317,7 +317,8 @@ 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); } @@ -904,7 +905,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto for (String bdName : this.beanDefinitionNames) { if (!beanName.equals(bdName)) { BeanDefinition bd = this.beanDefinitionMap.get(bdName); - if (beanName.equals(bd.getParentName())) { + if (bd != null && beanName.equals(bd.getParentName())) { resetBeanDefinition(bdName); } }