springboot配置文件的加载先后顺序
1、内部配置加载顺序:
springboot启动会扫描以下位置的application.properties或者application.yml文件作为Spring boot的默认配置文件
- 命令行配置
- –file:./config/ --> jar包所在的目录的config目录下
- –file:./ --> jar包所在目录
- –classpath:/config/ --> jar包中的resources/config目录下
- –classpath:/ --> jar包中的resources目录下
nacos上的配置 > 命令行配置 > system env > classpath:application.yml > classpath:bootstrap.yml