[Spring]设置property-placeholder绝对路径

来源:互联网 发布:网络摄像机安装过程 编辑:程序博客网 时间:2024/05/16 06:15

直接写<context:property-placeholder location="/sartner/conf/config.properties"/>

会报错

java.io.FileNotFoundException: sartner/conf/config.properties (没有那个文件或目录)

正确写法:

<context:property-placeholder location="file:/sartner/conf/config.properties"/>   (linux环境)

如果properties文件在classpath下则写成

<context:property-placeholder location="classpath*:cn/sartner/conf/config.properties"/>

 

参考链接:

http://forum.mulesoft.org/mulesoft/topics/absolute_relative_resourece_path_with_context_property_placeholder

http://stackoverflow.com/questions/4884704/referencing-configuration-properties-outside-of-the-war
0 0
原创粉丝点击