Spring 使用Properties配置文件(二)
重写占位符配置器PropertyOverrideConfigurer是Spring提供的一个容器后处理器,
它的属性文件指定的信息可以直接覆盖Spring XMl配置文件中的元数据。
也可以理解为:PropertyOverrideConfigurer属性文件是默认的配置信息
PropertyOverrideConfigurer属性文件,命名规则如下:
beanName.property=value
<!-- 指定多个属性文件 --><bean class="org.springframework.beans.factory.config.PropertyOverrideConfigurer"><property name="locations"><list><value>jdbc.properties</value></list></property></bean><!-- 或者location指定文件 --><context:property-override location="classpath:jdbc.properties"/><!-- 尽管该Bean没有配置任何属性,但会读取jdbc.properties的信息 --><bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> </bean>