Announcement Announcement Module
Collapse
No announcement yet.
Does Spring ignore duplicate property-placeholder files? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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>

    Comment


    • #3
      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.

      Comment

      Working...
      X