Can we redefine spring beans declared in one xml configuration in another configuration?

I am new to Spring, so this question may have an easy answer, so please take me if I ask for something stupid.

I have a global Spring configuration file that I want to use in many applications, and I would like to override some properties of several beans differently in different applications. Can you suggest a better way to do this?

For example, I have 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 transfer testInstancefrom another Spring configuration and use it after overriding mem1. Is this possible in spring? Do I need to use custom tags for this?

+5
source share
1

bean, xml, xml. @Configuration, , . Spring .

https://jira.springsource.org/browse/SPR-9567

+3

All Articles