Question

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?

Was it helpful?

Solution

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>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top