Sep 5th, 2012, 06:48 AM
Loading different properties file
I'm using spring 3.1.1
I'm in this situation: in my project I have several partners provided by several different organizations
Each partner will build a component (that is a jar) of my web application
Now partner A has its own spring context file and partner B has it's own spring context file
Both partner wants to use properties file where to put their own configuration params (e.g. database configuration and so on....) by using spring property place holder.
When they test locally all works pretty good; when I try under the web application only one property file is loaded....and this means that I can't make it working.
How can I solve this issue? An above all....can this issue be valid also for other bean? What I mean is: if partner A has its own datasource configuration and in spring context file this partner calls this datasource as "datasourceA" and if partner B has its own datasource configuration and in spring context file this partner calls this datasource as "datasourceB" when I put these jars under the my web application classpath....will I be sure that both datasources will be correctly loaded?
Sep 14th, 2012, 06:42 AM
You can use different prefixes when loading properties and/or importing spring context files .
If I where you I would consider using the same spring context file for both partners and then use property place holders  to set the information that is different, such as database name, user and password.
The properties file can be loaded from the classpath or from a absolute path on the filesystem.