码迷,mamicode.com
首页 > 编程语言 > 详细

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

时间:2015-09-06 18:38:19      阅读:196      评论:0      收藏:0      [点我收藏+]

标签:spring占位符获取值

	(<!-- 获取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$占位符读取配置文件值

标签:spring占位符获取值

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!