作为Spring属性的完整路径

Joh*_*Doe 4 java spring

说,我在Spring上下文中有以下bean:

<bean class="some.class.BlabBlahBlah">
    <property name="location" value="classpath:somefile.xml"/>
</bean> 
Run Code Online (Sandbox Code Playgroud)

目前somefile.xml放在src/main/java,但我想把它放在文件系统的某个地方.有没有办法做到这一点?我尝试设置完整路径而不是这个,classpath:但它不起作用.提前致谢.

nob*_*beh 8

通过引用(表4.1),您应该使用文件系统资源路径:

<property name="location" value="file:/path/to/file.xml" />
Run Code Online (Sandbox Code Playgroud)