<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location">
<value>/WEB-INF/reportConfig.properties</value>
</property>
<property name="fileEncoding" value="utf-8"/>
</bean>
1.<bean id="configBean" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
2. <property name="locations">
3. <list>
4. <value>classpath*:properties1.properties</value>
5. <value>properties2.properties</value>
6. <value>properties3.properties</value>
7. </list>
8. </property>
9.</bean>
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location">
<value>file:c:/reportConfig.properties</value>
</property>
<property name="fileEncoding" value="utf-8"/>
</bean>
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location">
<bean class="java.lang.System" factory-method="getenv">
<constructor-arg value="CIRC_REPORT"/>
</bean>
</property>
<property name="fileEncoding" value="utf-8"/>
</bean>
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE"/>
<property name=”ignoreResourceNotFound” value=”true”/>
<property name="location">
<value>${CIRC_REPORT}</value>
</property>
<property name="fileEncoding" value="utf-8"/>
</bean>
引用
PropertyOverrideConfigurer,类似于PropertyPlaceholderConfigurer,但是与后者相比,前者对于bean属性可以有缺省值或者根本没有值。如果起覆盖作用的 Properties文件没有某个bean属性的内容,那么缺省的上下文定义将被使用。
注意:bean 工厂的定义并不会意识到被覆盖,所以仅仅察看XML定义文件并不能立刻明显地知道覆盖配置是否被使用了。在有多个PorpertyOverrideConfigurer对用一个bean属性定义了不同的值的时候,最后一个将取胜(取决于覆盖的机制)。
Properties文件的一行配置应该是如下的格式:
beanName.property=value,其中beanName是需要覆盖的bean的名字,property是需要覆盖的属性名
分享到:
相关推荐
NULL 博文链接:https://wokeke.iteye.com/blog/2214113
在Spring3中配置数据源,包括DBCP,C3P0,Proxool,Bonecp主要的数据源,里面...<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <value>classpath:proxool.properties ...
6 <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> 7 8 9 <value>/WEB-INF/jdbc.properties 10 11 12 13 14 它配置了以下功能: 读取...
6.8.3. 使用Spring IoC来配置AspectJ的切面 6.8.4. 在Spring应用中使用AspectJ Load-time weaving(LTW) 6.9. 其它资源 7. Spring AOP APIs 7.1. 简介 7.2. Spring中的切入点API 7.2.1. 概念 7.2.2. 切入点实施 ...
Spring.NET是一个应用程序框架,其目的是协助开发人员创建企业级的.NET应用程序。它提供了很多方面的功能,比如依赖注入、面向方面编程(AOP)、数据访问抽象及ASP.NET扩展等等。Spring.NET以Java版的Spring框架为...
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <value>WEB-INF/jdbc.properties class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-...
#Spring 属性注释扩展的 PropertyPlaceHolderConfigurer 使用注解将配置属性注入到 Spring 组件中。 注意:Spring 3 现在支持使用 @Value 注释的容器的。 该项目仅用于 Spring 2.5.x 支持。 ##入门Spring房产注解...
4.8.2.1 示例:PropertyPlaceholderConfigurer. 82 4.8.2.2 示例:PropertyOverrideConfigurer 83 4.8.3 使用FactoryBean 来自定义实例化逻辑. 84 4.9 基于注解的容器配置. 85 4.9.1 @Required....
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <value>classpath*:jdbc.properties <!-- 数据源配置,主要用于开发测试...
spring3.1中文参考文档,南磊翻译,现在有4章,目录如下: 第一部分 Spring framework概述.......................................................................................................................
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <value>classpath:/deploy.properties <!-- 配置sessionFactory ...
与通过从属性文件读取其配置来进行自我配置相比,对于应用程序而言,有什么可能更简单? 好吧,对于业务应用程序而言,事实并非如此简单! 出现的问题如下:0.如何根据执行平台读取不同的属性? 0.如何保护敏感值,...
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <value>classpath:jdbc.properties ${driver}"/> ${url}"/> ${username}"/> ${password}"/> <!-- 配置...
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <!-- ${jdbc.driver}" /> ${jdbc.url}" /> ${jdbc.username}" /> ${jdbc.password}" /> 初始化连接大小 ...