简体   繁体   中英

Can't load multiple property files in spring's application context

I have three property files placed in a resource folder in classpath. The problem i am facing is while i am able to load invidual files separately i am unable to load them when they are declared together.

Please see the XML below:

<bean name="messageSource"
        class="org.springframework.context.support.ResourceBundleMessageSource">
    <property name="basenames"    value="resources\label"/>

</bean>
                                                                                                                                                                          This is working but the XML given below isn't:                                             
<bean name="messageSource"
        class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
    <property name="basenames"    value="resources\label,resources\button,resources\messages"/>
    <property name="cacheSeconds" value="1"/>
</bean>

I wish to declared them together as I wish to use a single bean to access all three files. Help required!

Found the answer . It should be like this
`

          <property name="basenames">
          <list>
               <value>classpath:resources\label</value>
               <value>classpath:resources\button</value>
               <value>classpath:resources\messages</value>
          </list>
          </property>

       </bean>

Do it like this

<property name="basenames">
    <list>
        <value>resources\label</value>
        <value>resources\button</value>
        <value>resources\messages</value>
    </list>
</property>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM