tags:

views:

452

answers:

1

Hello.

Is it possible to have multiple resource bundles in spring mvc? I want to separate my resource bundles for example one for errors, another for global messages, other for image names etc. so I don't have just one very big file

I'm using this

<bean id="messageSource"
class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="basename" value="messages" />
</bean>

But here i can just specify 1 resource, can I use more?

+2  A: 

You can just pass in a list using the setBasenames() method like this:

<beans>
  <bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
    <property name="basenames">
      <list>
        <value>images</value>
        <value>errors</value>
        <value>globalMsgs</value>
      </list>
    </property>
  </bean>
</beans>
khill
Thank you!! I will try that
Enrique