spring 的配置文件<context:property-placeholder>
原文出处:http://www.cnblogs.com/dream-to-pku/p/6367396.html
http://blog.csdn.net/Rickesy/article/details/50791534
在spring3.1之前<context:property-placeholder/> 命名空间注册了一个PropertyPlaceholderConfigurer的实例,如果你使用spring-context-3.0.xsd 之前依然是可以使用。
示例:例如一些配置文件中的常量为了简化不用频繁的更改参数配置信息,spring3.0中提供了一种简单的方式context:property-placeholder 元素。
只需要在spring的配置文件里添加一句:<context:property-placeholder location=””/>即可。这里的location值为参数配置文件的位置,参数配置文件与常用的参数配置文件相同,即键值对的形式。
<bean id="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:/druid.properties</value>
</list>
</property>
</bean>
<context:property-placeholder location="classpath:druid.properties"/>

浙公网安备 33010602011771号