类似于SessionLocaleResolver,适用于非基于Web的Spring应用程序

时间:2013-11-07 13:46:02

标签: java spring internationalization

如何在应用程序启动时将外部传递给上下文的某个区域设置对应的消息初始化Spring Application上下文(以及其中的所有bean)?使用SessionLocaleResolver的Web应用程序可以解决此问题,但对于非Web(标准桌面)应用程序,我找不到类似的内容。

如果我在XML配置文件中对其进行硬编码,我可以使用某些语言环境进行bean初始化:

<context:property-placeholder
file-encoding="UTF-8"
ignore-resource-not-found="true"
local-override="true"
ignore-unresolvable="true"
order="1"
system-properties-mode="FALLBACK"
location="classpath:locale/messages_ru_RU.properties" />

但我需要通过-D或Spring XML文件之外的一些配置文件传递语言环境。

0 个答案:

没有答案