【发布时间】:2013-06-30 21:07:11
【问题描述】:
如何配置 PropertyPlaceholderConfigurer 以使用相对于战争(某些目录)的属性文件?
我们已经多次运行战争,每次战争都应该从 ../../etc/db.properties 读取其配置。
更新:
是的,属性文件在战争之外。目录结构为:
/htdocs/shop/live/apache-tomat/webapps/shop.war
应该读
/htdocs/shop/live/etc/db.properties
和
/htdocs/shop/test/apache-tomat/webapps/shop.war
应该读
/htdocs/shop/test/etc/db.properties
【问题讨论】:
-
所以属性文件在战争之外?
-
如果你发布你的目录结构,我可以给你一个更好的答案。
-
添加了一些信息。
-
您需要将包含属性文件的目录添加到运行时类路径。然后使用
classpath:前缀来获取它。
标签: spring configuration