【发布时间】:2011-02-05 04:16:05
【问题描述】:
有没有办法在相对于 Spring 的上下文文件本身的文件系统(而不是类路径)上引用属性文件?
我想做的是如下:
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<!-- I want the below to be relative to this context XML file. -->
<value>app.properties</value>
</list>
</property>
</bean>
我在想像${contextpath} 这样的东西,我可以在上面的“app.properties”前面加上,但找不到任何有用的东西。
谢谢。
【问题讨论】:
-
你为什么不把路径放在属性文件上,然后用你的spring应用程序来获取它。是一样的吗?您可以动态更改您的属性文件内容值。
标签: java spring contextpath