My application can run on different environments. I need configure MY data model per environment. The data model is build using Spring beans.
I use Spring 3.0.5, so I cannot conditionally load resources. I have this:
<bean id="Template1" class="...
..............
</bean>
<bean id="Template2" class="...
..............
</bean>
<bean id="Template3" class="...
..............
</bean>
................
<bean id="Factory" ...>
<propety name="type"><value>${app.type}</value></property>
<property>
<map>
<entry key="Temlate1" value-ref="Template1">
<entry key="Temlate2" value-ref="Template1">
<entry key="Temlate3" value-ref="Template1">
..................
Real bean I create by factory:
<bean id="real" factory="Factory" factory-method="getInstance"
<constructor-arg>Factory</.....
.............
</bean>
Java code:
class Factory {
private Map<String, Object> templateBeans;
Object getInstance(String name) {
return templateBeans.get(name);
...........
Is it possible in some way to declare abstract template beans? Because I have very big problem with memory. Does another way exist to instantiate different beans conditionally in Spring before version 3.1? It would be good to use only EL because I don't have access to the Java code of the beans as they are from a third-party library.