Let's say I have the following modules/projects:
-) myAppDAO
-) myAppJabber
-) myApp
Each project has its own spring context. Since I need to load db / jabber connection properties, I have a PropertyPlaceholderConfigurer set up for both of them (each in their own context file):
Code:<bean id="dbProperties" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="ignoreResourceNotFound" value="true" /> <property name="locations"> <list> <value>classpath:/db.default.properties</value> <value>classpath:/db.properties</value> </list> </property> </bean>The problem comes in when I'm using both modules in my main application where I load the context files from every module - creating one big application context. Now it seems like only one PropertyPlaceholderConfigurer gets used and I get exceptions when I try to inject a property from the other one into a bean: "Could not resolve placeholder 'db.host'"Code:<bean id="jabberProperties" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="ignoreResourceNotFound" value="true" /> <property name="locations"> <list> <value>classpath:/jabber.default.properties</value> <value>classpath:/jabber.properties</value> </list> </property> </bean>
When I add the jabber.properties in the PropertyPlaceHolderConfigurer of the dao module (or vice versa), everything works just fine. It also works if I remove the PropertyPlaceHolderConfigurer from both modules and just add one big one in the main application. Both ways suck imo.
What would be the correct way to load a dedicated property file for each project/module and still use them alltogether in one context?


Reply With Quote
roperty-placeholder />