+ -
当前位置:首页 → 问答吧 → spring加载外部配置文件。

spring加载外部配置文件。

时间:2011-11-01

来源:互联网

<context:property-placeholder location="classpath:jdbc.properties"/> 
jdbc.properties在src下面可以读取到,我想放到项目外的地方,比如c盘下 
<context:property-placeholder location="classpath:c:\data\jdbc.properties"/> 为什么这样找不到,有什么办法可以读到吗? 

作者: xiaobadi   发布时间: 2011-11-01

只能写相对路径吧

作者: pmlxp   发布时间: 2011-11-01

不是用classpath吧。file:

作者: lijing0511   发布时间: 2011-11-01

<context:property-placeholder location="c:/jdbc.properties"/>  
这样可以?

作者: huangjinjin520   发布时间: 2011-11-01

引用 2 楼 lijing0511 的回复:
不是用classpath吧。file:

这样可以,谢谢,真是救我了。。

作者: xiaobadi   发布时间: 2011-11-01