Jun 29th, 2006, 04:43 PM
Chained BeanFactories and name resolution
I have two BeanFactory instances:
- an XmlBeanFactory that reads my core config
- a custom BeanFactory ("DynamicBeanFactory") that interacts with the XmlBeanFactory to support beans that are not in the XML config.
I have the XmlBeanFactory as the parent of the DynamicBeanFactory. If I call getBean() on the DynamicBeanFactory, it checks the parent first to get a "template" bean, then applies some logic to synthesize a "dynamic bean" if necessary.
This works great--however, I would like to define a bean in my XML config that takes a reference to a "dynamic bean". This would be possible if the DynamicBeanFactory were a parent of the XmlBeanFactory---but it is already a child!
Is there any way for a BeanFactory to resolve bean names "globally" across the full chain that they participate in, including children?