首页 > 编程语言 > 详细

spring$占位符读取配置文件值

时间:2015-09-06 18:36:37      阅读:346      评论:0      收藏:0      [点我收藏+]
	(<!-- 获取properties数据源文件 方式一 -->
	<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">  
        <property name="locations">  
            <list>  
                <value>classpath:/ssh-config/spring_2.5.5/c3p0.properties</value>  
            </list>  
        </property>  
    </bean> 
	
	
	<!-- 获取properties数据源文件 方式二 -->
	<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">  
		<property name="location" > 
			<value>classpath:/ssh-config/spring_2.5.5/c3p0.properties</value>
		</property>
    </bean> 
	
	
	<!-- 获取properties数据源文件 方式三 -->
	<context:property-placeholder location="classpath:/ssh-config/spring_2.5.5/c3p0.properties"/>


  1. 可以配置多个文件,2,3配置一个。

2.  加载配置文件之后,在spring的xml配置文件里可以使用${}来获取 配置文件里面的值

spring$占位符读取配置文件值

原文:http://yjm199.blog.51cto.com/4408395/1691811

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!