java springboot 外部约定配置文件加载顺序

19 阅读1分钟

springboot 启动还会扫描以下位置的applicaiton.properties或者application.yml文件 作为Spring boot的默认配置文件。

1、classpath 根目录下的

2、classpath根config/

3、项目根目录

4、项目根目录/config

5、直接子目录/config

java -jar configuration_file-0.0.1-SNAPSHOT.jar --spring.config.location=D:\config/