1

如何在应用程序启动时使用与特定语言环境相对应的消息初始化 Spring 应用程序上下文(以及其中的所有 bean)?对于使用 Web 应用程序,可以解决此问题,SessionLocaleResolver但对于非 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" />

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

4

0 回答 0