一:在配置文件aplicationContext-service添加:
 
<context:property-placeholder location="classpath:path.properties" ignore-unresolvable="true" file-encoding="UTF-8" />
 
二:编写配置文件
 
spirng通过@value获取配置文件的值

 

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

 

相关文章: