I am a newbie to Spring so this question might have an easy answer so please bear me if i'm asking something silly.
I have a global spring config file which I want to use in many applications and I would like to override some properties of few beans differently in different applications. Can you suggest the best way to do this?
For example, I've something like this in global.xml
.
<bean id="testInstance" class="testClass">
<property name="mem1" ref="val1"/>
<property name="mem2" ref="val2"/>
</bean>
Now, I want to refer testInstance
from a different spring config and use it after overriding mem1
. Is it possible in spring? Do i need to use custom tags for that?
You can override a bean defined in xml in another xml config. But if you want to leverage @Configuration to do same then you are out of luck. Spring does not allow to do that.
https://jira.springsource.org/browse/SPR-9567
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With