【发布时间】:2011-07-25 08:57:02
【问题描述】:
我有以下 spring 配置文件:
<context:property-placeholder order="2"
ignore-unresolvable="true" ignore-resource-not-found="true"
location="file:///${user.home}/application.properties" />
<context:property-placeholder order="1"
ignore-unresolvable="true" ignore-resource-not-found="true"
location="file:///C:/Services/Tomcat 6.0/cms/application.properties" />
<context:property-placeholder order="3"
location="classpath:com/afrozaar/cms/service/application.properties" />
注意它们是如何排序的,有些在类路径上,有些在文件系统上。
现在我想添加一个通过 jndi 加载的属性文件。我希望能够做到
<context:property-placeholder order="2"
ignore-unresolvable="true" ignore-resource-not-found="true"
location="jndi:url/application.properties" />
不幸的是,这不起作用,spring 不支持 jndi 前缀... AFAIK。
那么,我可以这样做吗?
如果我做不到,我的选择是什么。我不想将我的整个配置转换为一个完整的基于 bean 的属性占位符配置器。
【问题讨论】: