0

I have a applicationContext that loads a properties file and a bean that is injected as a resource. This works correctly.

<bean id="testSettings" class="com.icat.di.testing.framework.TestSettings" scope="singleton"/>
<util:properties id="testProperties" location="classpath:${test.properties}" />

I would like to add a second properties file. I've read that multiple <util:properties entries are not allowed.

I tried the older method of adding a list of properties:

<bean id="testSettings" class="testing.framework.TestSettings">
    <property name="testProperties">
        <list>
            <value>classpath:test.properties</value>
        </list>
    </property>
    <property name="configProperties">
        <list>
            <value>classpath:config.properties</value>
        </list>
    </property>
</bean>

I added configProperties as a resource in my TestSettings class. This fails to load the application context.

How do you load two properties files in Spring 4?

ABC123
  • 1,037
  • 2
  • 20
  • 44
  • I think this question was answered a time ago on this link http://stackoverflow.com/questions/8924912/multiple-properties-files-in-spring-3-0. – e2a Mar 31 '16 at 19:59
  • Turns out you can have multiple . I had some other conflicting changes. – ABC123 Mar 31 '16 at 20:55

1 Answers1

0

Try to add this property in your bean:

    <property name="ignoreUnresolvablePlaceholders" value="true"/>
Matteo Baldi
  • 5,613
  • 10
  • 39
  • 51