Results 1 to 3 of 3

Thread: Does Spring ignore duplicate property-placeholder files?

  1. #1

    Default Does Spring ignore duplicate property-placeholder files?

    We have multiple project jars that get used in different war files. So in order to compile the specific jar files, each jar's Spring context file has a property-placeholder for a file called foo.properties.

    So when a war is built with 10 jars, it essentially has 10 Spring Context Files that it is loading, all with their own property-placeholder configuration for the same file.

    I see in Spring the same file get loaded for each property-placeholder.

    Is there a setting in Spring that if it finds a property-placeholder for a file with same name in the graph of context files, that it can ignore loading that file?

    If not, which method in PropertyPlaceholderConfigurer is the best one to override and implement this functionality?

    Thanks

  2. #2
    Join Date
    Jan 2012
    Posts
    2

    Default

    When i need to import multiple properties i create a list, but files need to have diferent names. Cant you do that ?

    Code:
    <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="ignoreResourceNotFound" value="true"/>
        <property name="locations">
            <list>
                <value>classpath:foo1.properties</value>
                <value>classpath:foo2.properties</value>
            </list>
        </property>
    </bean>

  3. #3

    Default

    Thanks, but I am specifically asking whether Spring has a feature to ignore duplicate property-placeholder files instead of wasting processing time reloading/merging them. And if not, how can I override the Spring implementation to ignore filenames that have already been loaded.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •