spring中引入资源文件

spring配置文件中引入外部的properties的文件,xml中的部分代码如下
<!-- 分散配置 -->
	<bean id="propertyPlaceholderConfigurer"
		class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
		<property name="location">
			<value>cn/csdn/domain/jdbc.properties</value>
		</property>
	</bean>
	<!-- 使用外部 的jdbc.properties文件-->
	<bean id="connServiceImpl" class="cn.csdn.util.ConnServiceImpl"
		scope="singleton">
		<property name="driverClass">
			<value>${driverClass}</value>
		</property>
		<property name="url">
			<value>${url}</value>
		</property>
		<property name="user">
			<value>${username}</value>
		</property>
		<property name="password">
			<value>${password}</value>
		</property>
	</bean>

猜你喜欢

转载自hongmeikaile.iteye.com/blog/1036207