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

Spring 读取配置文件的俩种方式

时间:2017-01-13 21:04:47      阅读:176      评论:0      收藏:0      [点我收藏+]

标签:pre   bsp   odi   tle   ram   context   class   utf-8   path   

读取配置可通过 org.springframework.core.env.Environment 类来获取, 也可以通过@Value的方式来获取

 

注解形式:

@PropertySource({"classpath:application.properties"})

 

配置文件形式:

<context:property-placeholder location="classpath:jdbc.properties" file-encoding="utf-8" ignore-unresolvable="true" />

Spring 读取配置文件的俩种方式

标签:pre   bsp   odi   tle   ram   context   class   utf-8   path   

原文地址:http://www.cnblogs.com/pengyusong/p/6283300.html

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