Announcement Announcement Module
Collapse
No announcement yet.
Loading different properties file Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Loading different properties file

    Hi there
    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?

    Thank you
    Cheers,
    Angelo

  • #2
    You can use different prefixes when loading properties and/or importing spring context files [1].

    If I where you I would consider using the same spring context file for both partners and then use property place holders [2] 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.

    [1] http://static.springsource.org/sprin...resourceloader
    [2] http://static.springsource.org/sprin...lderconfigurer

    Best regards
    Pontus Ullgren

    Comment

    Working...
    X