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

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

 

注解形式:

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

 

配置文件形式:

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

posted @ 2017-01-13 16:40  彭玉松  阅读(202)  评论(0编辑  收藏  举报