
Originally Posted by
wallychang
Is there any way to inherit these common entries to reduce clutter?
If you are instantiating the many instances of the same class then you can inherit configuration:
Code:
<bean id="exampleClass" abstract="true" class="yourClass">
<property name="xyz" value="abc"/>
</bean>
<bean id="aRealClass" parent="exampleClass"/>
This won't really help in your situation though 
I don't think there is anything out of the box that will help you, but the following might be a good start:
Code:
<bean id="baseList" class="org.springframework.beans.factory.config.ListFactoryBean">
<property name="sourceList">
<list>
<value>someProperty</value
<value>someOtherProperty</value
</list>
</property>
</bean>
<bean id="yourBean" class="yourClass">
<property name="yourProperty" ref="baseList"/>
</bean>
That will get you someway, but I don't know of any factory bean to add to the existing list, however the following will do:
Code:
public class ListAddingBeanBean implements FactoryBean {
private final List lists;
public ListAddingBeanBean (final List theLists) {
this.lists = theLists;
}
public Object getObject() {
// as we are singleton, we could cache this :)
List newList = new ArrayList();
for (Iterator i = lists.iterator; i.hasNext(); ) {
List list = (List) i.next();
newList.addAll(list);
}
return newList;
}
public Class getObjectType() {
return List.class; // could be parameterisable of course.
}
public boolean isSingleton() {
return truel
}
}
This would then be wired up:
Code:
<bean id="someOtherClass" class="yourClassAgain">
<property name="somethingTakingAList">
<bean class="ListAddingFactoryBean">
<list>
<ref local="baseList"/>
<list>
<value>abc</value>
<value>def</value>
</list>
</list>
</bean>
</property>
</bean>
I have *no* idea whether the above will work, and I am sure, after having typed all that that there *must* be a more elegant solution 
Anyways; subject to someone pointing out a better way; I hope it helps