> 文档中心 > springboot spring.config.location外挂配置文件实战

springboot spring.config.location外挂配置文件实战


1.springboot版本

目前我的springboot版本是v2.2.2.RELEASE

2.合并配置文件到一个文件

在centos 7 系统中,增加一个文件 default.properties ,最后把我们需要的配置文件,放在这个文件里。

3.启动脚本

特别注意:这里是两个 - - 的。

--spring.config.location=/xxx/xx/xxx/default.properties

这里的xxx,代表着自己的目录

4.完整的案例

nohup java -jar /data/project/pc/pc.jar --spring.config.location=/data/project/pc/default.properties >/dev/null 2>/data/project/pc/log &