1.指定文件路径
<bean id="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>file:${SANP_HOME}/config.properties</value>
</list>
</property>
</bean>
其中${SANP_HOME} 为环境变量,当然file:可以试绝对路径
2.读取classpath
<bean id="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:config.properties</value>
</list>
</property>
</bean>
这里classpath:config.properties,路径就是源码的根路径,与classes同层级
posted on 2012-10-10 14:22
蒋家狂潮 阅读(606)
评论(0) 编辑 收藏 所属分类:
Basic