xml中从配置文件读取配置信息
两种方法:
1、PropertyPlaceholderConfigurer
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="locations"> <list> <value>classpath:jdbc.properties</value> <value>classpath:hibernate.properties</value> </list> </property> </bean>
2、context:property-placeholder
<context:property-placeholder location="classpath:jdbc.properties,classpath:hibernate.properties"/>