Issue
Is that possible to define at Spring XML context few beans with the same property set?
Example
<bean id="bean1" class="com.my.company.model.MyProcedureBean">
<property name="name" value="val1"/>
<property name="pre">
<list>
<ref bean="Y00"/>
<ref bean="YNT"/>
<ref bean="YAB"/>
</list>
</property>
<property name="post">
<list>
<ref bean="YIO"/>
<ref bean="YC1"/>
</list>
</property>
<property name="plain">
<list>
<ref bean="YA3"/>
<ref bean="YP4"/>
<ref bean="YA5"/>
</list>
</property>
</bean>
<bean id="bean2" class="com.my.company.model.MyProcedureBean">
// DO NOT WANT TO DUPLICATE ALL PROPERTIES HERE AS AT **bean1**
</bean>
Solution
Set the Abstract property of a bean to true and then defin other bean with parent property equal to the abstract bean! like this
<bean id="parentBean" class="xxx" abstract="true">
<property name="..." value="..." />
<property name="..." value="..." />
<property name="..." value="..." />
</bean>
<bean id="bean1" parent="parentBean">
</bean>
<bean id="bean2" parent="parentBean">
</bean>
Answered By - Morteza Adi
Answer Checked By - Katrina (JavaFixing Volunteer)