【发布时间】:2013-02-20 03:04:17
【问题描述】:
这是我的 applicationContext 定义的一部分,用于检索一些属性。
<!-- get some properties -->
<context:property-placeholder
ignore-resource-not-found="false" ignore-unresolvable="false"
location="classpath:/properties/${spring.profiles.active:test}/some.properties"/>
如您所见,我让 spring.profiles.active 决定将读取哪些属性。 我的测试带有注释:
@ActiveProfile("integration")
您猜对了,我的 spring bean 配置文件实际上与部署/测试应用程序的环境相匹配。 我的位置属性仍然被解析为“/properties/test/some.properties”。这当然是因为 spring.profiles.active 在这种情况下似乎没有得到解决。
我怎样才能获得正确的属性?
【问题讨论】:
标签: spring properties configuration applicationcontext profiles