有没有办法通过Spring加载属性文件,而不是在我的类路径中?我试过这样的事情
<bean id="variableProperties"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:network.properties</value>
<value>/conf/app.properties</value>
</list>
</property>
此处未加载/conf/app.properties并抛出
Could not load properties; nested exception is java.io.FileNotFoundException: classpath resource [conf/app.properties] cannot be opened because it does not exist
答案 0 :(得分:0)
尝试file:/conf/app.properties
,但我认为你必须把绝对路径放在其中