0

我有一个遗留应用程序,我正在努力实现一些要求。这样做时,我想为每个环境加载环境特定的属性文件。例如:

<context:property-placeholder location="classpath:myResource/data.properties" />

我想根据 local、dev、qa 等环境加载这个 data.properties 文件。我知道我们在 Spring 3.0 之后有配置文件配置,但我们没有任何计划很快升级当前版本。有没有一种方法可以像我们通过激活配置文件一样完成?

我尝试了以下方法但没有奏效:我将 jvm 参数作为 -Dprofile=dev 传递

<context:property-placeholder ignore-resource-not-found="true" location="classpath:myResource/data-${profile}.properties/>
4

0 回答 0