Contextual BeanCreationException in case of depending on a missing bean

Issue: SPR-16628

(cherry picked from commit 937cd48)
This commit is contained in:
Juergen Hoeller
2018-03-23 17:32:08 +01:00
parent 977084a6b8
commit f2478cf8cf

View File

@@ -293,7 +293,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);
}
}
}