Contextual BeanCreationException in case of depending on a missing bean

Issue: SPR-16628
This commit is contained in:
Juergen Hoeller 2018-03-23 17:32:08 +01:00
parent 38dcd179d5
commit 937cd48fcb
1 changed files with 7 additions and 1 deletions

View File

@ -300,7 +300,13 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
"Circular depends-on relationship between '" + beanName + "' and '" + dep + "'");
}
registerDependentBean(dep, beanName);
getBean(dep);
try {
getBean(dep);
}
catch (NoSuchBeanDefinitionException ex) {
throw new BeanCreationException(mbd.getResourceDescription(), beanName,
"'" + beanName + "' depends on missing bean '" + dep + "'", ex);
}
}
}