开发者

Spring MVC resource bundles

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜