I have a list of implementations of an interface managed by Spring in the main module of my project:
<bean id="mail-properties-service" class="com.mail.wrapper.MailPropertiesWrapper" init-method="flushProperties">
<property name="propertiesService" ref="application-properties-service"/>
</bean>
<bean id="record-properties-service" class="com.record.wrapper.RecordPropertiesWrapper" init-method="flushProperties">
<property name="propertiesService" ref="application-properties-service"/>
</bean>
<bean id="admin-properties-service" class="com.admin.wrapper.SystemAdminPropertiesWrapper" init-method="flushProperties">
<property name="propertiesService" ref="application-properties-service"/>
</bean>
<bean id="user-properties-service" class="com.user.wrapper.UserAdminPropertiesWrapper" init-method="flushProperties">
<property name="propertiesService" ref="application-properties-service"/>
</bean>
<bean id="email-campaign-properties-service" class="com.email.wrapper.EmailCampaignPropertiesWrapper" init-method="flushProperties">
<property name="propertiesService" ref="application-properties-service"/>
</bean>
<util:list id="properties-wrappers" value-type="com.wrapper.AbstractPropertiesWrapper">
<ref bean="mail-properties-service"/>
<ref bean="record-properties-service"/>
<ref bean="admin-properties-service"/>
<ref bean="user-properties-service"/>
<ref bean="email-campaign-properties-service"/>
</util:list>
This list is used by a general wrapper manager to issue clear cache instructions when properties change, plus other things.
I also have extensions to the project, for instance a SOP module. It would be nice somewhere in the applicationContext.xml file in the SOP module to have something like this:
<bean id="sop-properties-service" class="com.sop.wrapper.SOPPropertiesWrapper" init-method="flushProperties">
<property name="propertiesService" ref="application-properties-service"/>
</bean>
<bean ref="properties-wrappers">
<add-item ref="sop-properties-service"/>
</bean>
This way, the main project config doesnt have to know about the SOP module, and the module can add it's wrapper to the wrappers list. Is there any way to do this?
Thanks in advance.