Aug 1st, 2007, 05:48 PM
Overriding entire bean definition
I have an application in which I create an XmlBeanFactory. I create an XmlBeanReader which I used to loadBeanDefinitions() from several more files that vary depending on that the contents of that first file.
What I want to do is define some default beans by name in that first file
and have one of those subsequent files just also contain a
which redefines that bean.
Effectively, this would be the same if I had some kind of XML merging function which overwrote things at the <bean> level and I merged each document in that root document one by one.
Is this possible?
If an XmlBeanReader reads the same bean id in two files will it throw?
Aug 2nd, 2007, 04:39 AM
yes this is possible. The last bean definition will override the first bean definition. So you have to take care while loading the applicationcontext, to laod it in the correct sequence
Note you can also use hierarchies in the beanfactory (parent/child beanfactoryies). Then the child beandefinition willl override the parent bean definition.