我目前使用Spring ReloadableResourceBundleMessageSource
作为MessageSource
来阅读国际化消息。
我使用的Spring版本是: 4.3.1.RELEASE
<bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
<property name="basenames">
<list>
<value>classpath:messages/messages</value>
</list>
</property>
<property name="cacheSeconds" value="1" />
<property name="defaultEncoding" value="UTF-8" />
</bean>
问题是我想将PropertiesConfiguration (from Apache Commons Configuration 2)用作MessageSource
。我遇到的问题是两者都扩展了不同的类。我需要知道Apache Commons Configuration是否提供了现成的MessageSource
PropertiesConfiguration
或者如何使用此配置创建新的MessageSource
。
使用此配置的好处是拥有Variable Interpolation类中不可用的Properties。
我的问题基于this question,但有一点麻烦,因为我不直接在我的应用中使用属性,而是通过Spring提供的消息源,我不想更改该代码。< / p>