spirng通过@value获取配置文件的值

一:在配置文件aplicationContext-service添加:
 
<context:property-placeholder location="classpath:path.properties" ignore-unresolvable="true" file-encoding="UTF-8" />
 
二:编写配置文件
 

 

 
三:注解获取配置文件的值
@Value("${basePath}")
     private String basePath;

 

posted @ 2017-04-13 16:35  currystar  阅读(1178)  评论(0编辑  收藏  举报