-
Aug 1st, 2007, 05:48 PM
#1
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
<bean id="thing_i_need"/>
and have one of those subsequent files just also contain a
<bean id="thing_i_need"/>
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
#2
Hello,
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
defaultBeans.xml, specialBeans.xml.
Note you can also use hierarchies in the beanfactory (parent/child beanfactoryies). Then the child beandefinition willl override the parent bean definition.
rgds
agim
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules