【理论介绍】
配置文件加载顺序:
1、项目根目录下的config目录。【优先级最高】
2、项目根目录。
3、classpath下的config目录。
4、classpath目录(新建项目时application.properties默认所在位置)。【优先级最低】
备注:
加载顺序:4 -> 3 -> 2 -> 1。
优先级:逐渐减低(1>2>3>4)。
【举例说明】
项目结构示例:
1、项目根目录下的config目录(file:./config/):helloworld/config/
2、项目根目录(file:./):helloworld/
3、classpath下的config目录(classpath:/config/):helloworld/src/main/resources/config/
4、classpath目录(classpath:/