mirror of
https://github.com/spring-projects/spring-framework
synced 2026-06-08 17:33:33 +00:00
Contextual BeanCreationException in case of depending on a missing bean
Issue: SPR-16628
This commit is contained in:
+6
@@ -300,8 +300,14 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
|||||||
"Circular depends-on relationship between '" + beanName + "' and '" + dep + "'");
|
"Circular depends-on relationship between '" + beanName + "' and '" + dep + "'");
|
||||||
}
|
}
|
||||||
registerDependentBean(dep, beanName);
|
registerDependentBean(dep, beanName);
|
||||||
|
try {
|
||||||
getBean(dep);
|
getBean(dep);
|
||||||
}
|
}
|
||||||
|
catch (NoSuchBeanDefinitionException ex) {
|
||||||
|
throw new BeanCreationException(mbd.getResourceDescription(), beanName,
|
||||||
|
"'" + beanName + "' depends on missing bean '" + dep + "'", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create bean instance.
|
// Create bean instance.
|
||||||
|
|||||||
Reference in New Issue
Block a user