Merge pull request #13818 from Johnny Lim

* gh-13818:
  Add null guards for getBeanDefinition() in BeanTypeRegistry
pull/13985/head
Andy Wilkinson 6 years ago
commit f1cf41f544

@ -159,7 +159,10 @@ final class BeanTypeRegistry implements SmartInitializingSingleton {
} }
private void addBeanTypeForNonAliasDefinition(String name) { private void addBeanTypeForNonAliasDefinition(String name) {
addBeanTypeForNonAliasDefinition(name, getBeanDefinition(name)); RootBeanDefinition beanDefinition = getBeanDefinition(name);
if (beanDefinition != null) {
addBeanTypeForNonAliasDefinition(name, beanDefinition);
}
} }
private RootBeanDefinition getBeanDefinition(String name) { private RootBeanDefinition getBeanDefinition(String name) {
@ -219,11 +222,13 @@ final class BeanTypeRegistry implements SmartInitializingSingleton {
if (!this.beanFactory.isAlias(name) if (!this.beanFactory.isAlias(name)
&& !this.beanFactory.containsSingleton(name)) { && !this.beanFactory.containsSingleton(name)) {
RootBeanDefinition beanDefinition = getBeanDefinition(name); RootBeanDefinition beanDefinition = getBeanDefinition(name);
RootBeanDefinition existingDefinition = this.beanDefinitions.put(name, if (beanDefinition != null) {
beanDefinition); RootBeanDefinition existingDefinition = this.beanDefinitions
if (existingDefinition != null .put(name, beanDefinition);
&& !beanDefinition.equals(existingDefinition)) { if (existingDefinition != null
addBeanTypeForNonAliasDefinition(name, beanDefinition); && !beanDefinition.equals(existingDefinition)) {
addBeanTypeForNonAliasDefinition(name, beanDefinition);
}
} }
} }
} }

Loading…
Cancel
Save