I'm trying to find a way to re-use a spring configuration. The component I want to reuse is working like that:
The component is assembled inside the Spring context using a 'configBuilder'. The config builder is a bean that parse a string retrieved from a PropertyPlaceholderConfigurer to create a Config bean. The resulting config bean is injected into the component.
here is sample config file:
<bean id="propertiesPlaceholder" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<util:list>
<value>classpath:myService.properties</value>
</util:list>
</property>
<property name="ignoreUnresolvablePlaceholders" value="true"/>
</bean>
<bean id="myServiceConfigBuilder" class="com.ServiceConfigBuilder"/>
<bean id="myService" class="myServiceConfigBuilder">
<property name="serviceConfig">
<bean factory-bean="myServiceConfigBuilder" factory-method="buildFromProperty">
<constructor-arg value="${config.parameters}"/>
</bean>
</property>
</bean>
The service is a Spring post-processor that applies on some properties of some beans. Selecting properties is done using the config builder using expresions like:
beanA: property1, property2
So I want to be able to add more expression while loading my root context and its children.
For example if I have: rootContext that imports (kidA, kidB, kidC), I want to able to declare the post processor service in rootContext, read a first property from rootContext to create a config, and then to read a property for each sub context and create config from each of them. The postprocessor will be then created using a merged config.
Do you see a way to achieve this ? The PropertyPlaceholderConfigurer is not looking like a good solution, but I don't have any idea of how to perform that.