本文主要是介绍PropertyPlaceholderConfigurer配置,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
多数的鲜为人知方法都是因为有着罕见的应用,就比如说Spring中PropertyPlaceholderConfigurer这个类,它是用来解析Java Properties属性文件值,并提供在spring配置期间替换使用属性值。接下来让我们逐渐的深入其配置。
<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">
<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>
这篇关于PropertyPlaceholderConfigurer配置的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!