java如何在Spring中将Apache Commons属性配置用作消息源?
我目前使用Spring中的ReloadableResourceBundleMessageSource
作为MessageSource
来读取国际化消息
我使用的Spring版本是:4.3.1。释放
<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配置是否提供了带有PropertiesConfiguration
的现成MessageSource
,或者如何使用此配置创建新的MessageSource
使用此配置的优点是具有在Java的Properties类中不可用的Variable Interpolation
我的问题是基于this question,但有一点扭曲,因为我不直接在我的应用程序中使用属性,而是通过Spring提供的消息源,我不想更改代码
共 (0) 个答案