Commit 0fd4e40e authored by Johnny Lim's avatar Johnny Lim Committed by Andy Wilkinson

Add null guards for getBeanDefinition() in BeanTypeRegistry

Closes gh-13818
parent 9c5330f0
......@@ -159,7 +159,10 @@ final class BeanTypeRegistry implements SmartInitializingSingleton {
}
private void addBeanTypeForNonAliasDefinition(String name) {
addBeanTypeForNonAliasDefinition(name, getBeanDefinition(name));
RootBeanDefinition beanDefinition = getBeanDefinition(name);
if (beanDefinition != null) {
addBeanTypeForNonAliasDefinition(name, beanDefinition);
}
}
private RootBeanDefinition getBeanDefinition(String name) {
......@@ -219,8 +222,9 @@ final class BeanTypeRegistry implements SmartInitializingSingleton {
if (!this.beanFactory.isAlias(name)
&& !this.beanFactory.containsSingleton(name)) {
RootBeanDefinition beanDefinition = getBeanDefinition(name);
RootBeanDefinition existingDefinition = this.beanDefinitions.put(name,
beanDefinition);
if (beanDefinition != null) {
RootBeanDefinition existingDefinition = this.beanDefinitions
.put(name, beanDefinition);
if (existingDefinition != null
&& !beanDefinition.equals(existingDefinition)) {
addBeanTypeForNonAliasDefinition(name, beanDefinition);
......@@ -229,6 +233,7 @@ final class BeanTypeRegistry implements SmartInitializingSingleton {
}
}
}
}
/**
* Attempt to guess the type that a {@link FactoryBean} will return based on the
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment