【发布时间】:2009-08-21 11:11:15
【问题描述】:
我需要在程序运行之前从我不知道的位置将一些属性加载到 Spring 上下文中。
所以我想如果我有一个没有位置的 PropertyPlaceholderConfigurer,它会从系统属性中读取my.location,然后我可以在上下文中使用该位置:property-placeholder
这样
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
<context:property-placeholder location="${my.location}"/>
但这不起作用,location="classpath:${my.location}"也不起作用
保罗
【问题讨论】:
-
你不能像这样组合两个占位符——它们是 BeanFactoryPostProcessors,如果你明白我的意思,它们不能相互处理。
-
是的,我认为我的问题是这样的
-
实际上,这听起来像是对 PropertyPlaceHolderConfigurer 的增强,可能值得在 Spring JIRA 中作为功能请求提交。