applicationContext.xml读取properties中属性
applicationContext.xml读取properties中属性两种方法:
原文:[https://www.iteye.com/blog/fionajw-674981]
1
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">
<context:property-placeholder location="classpath:uc.properties" />
<!--
<bean id="configBean"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<value>uc.properties</value>
</property>
</bean>
-->
2
<bean id="configBean"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location">
<value>hello.properties</value>
</property>
</bean>
引用:
<property name="list">
<list>
<value>aaa</value>
<value>${name}</value>
<ref bean="date" />
</list>
</property>
3、如果有多个.properties档案,则可以透过locations属性来设定,例如:
见原文