<context:从文件系统加载property-placeholder

use*_*321 2 spring properties

<context:property-placeholder ignore-unresolvable="true" location="classpath:test.properties" />
Run Code Online (Sandbox Code Playgroud)

上面提到的从contex:property-placeholder加载属性文件的方法很好.我想要做的是从文件系统加载属性文件.

假设我有C盘中的文件C:\spring\test.properties.在这里我如何使用加载文件 context:property-placeholder.

Ian*_*rts 7

使用file:URL而不是classpath:一个

<context:property-placeholder ignore-unresolvable="true"
     location="file:/C:/spring/test.properties" />
Run Code Online (Sandbox Code Playgroud)