开发者

Spring MVC resource bundles

开发者 https://www.devze.com 2022-12-09 20:08 出处:网络
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 h

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" />开发者_Go百科
</bean>

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


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

精彩评论

暂无评论...
验证码 换一张
取 消