Announcement Announcement Module
Collapse
No announcement yet.
Aggregating external property files Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Aggregating external property files

    Hi,

    I have a problem and was wandering if anyone can help. The app I'm working on has many individual components that get thrown together at build time. Each component can define its own spring configuration and I need to aggregate these accross the board into one application context. The result of the build is a directory full of spring xml files and a directory full of property files. (The idea being a core component defines a framework, interfaces, managers etc and the other external components implement / hook into the system to provide actual functionality).

    I've been loading these into a FileSystemXmlApplicationContext, but am hitting a problem / brick wall with the property file includes as the property-placeholder / configurer I think is being redefined each time by each file. The result being I have an application context that can only pull in the properties from 1 properties file and throws many errors with missing properties.

    Is there a way to aggregate these property files without having to script around the side?

    I have the power to change the way these spring files are being defined, but the basic paradigm of aggregating multiple files I cant change. (would be interested though if there was a better way of doing this)

    Thanks for any help,
    Jon.
    Last edited by jon.mithe; Dec 17th, 2010, 01:15 PM.

  • #2
    Aha, in my core file I can define this:

    Code:
    <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
      <property name="locations">
        <list>
          <value>properties/*.properties</value>
        </list>
      </property>
    </bean>
    and then all the external components included in the build just use properties and include property files, but do nothing with the PropertyPlaceholderConfigurer / let the core aggregate it. Awesomes.

    Just wandering if anyone would like to comment on this approach, is there a more "spring" way of doing this?

    Anyways, cheers,
    Jon
    Last edited by jon.mithe; Dec 17th, 2010, 02:04 PM.

    Comment

    Working...
    X