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

三:注解获取配置文件的值
@Value("${basePath}")
private String basePath;
<context:property-placeholder location="classpath:path.properties" ignore-unresolvable="true" file-encoding="UTF-8" />
|
转载于:https://www.cnblogs.com/currystar/p/6704615.html