内部配置加載順序
Springboot程式啟動時,會從以下位置加載配置檔案:
- file: ./config/:目前項目下的/config目錄下
- file: ./ ︰目前項目的根目錄
- classpath:/config/: classpath的/config目錄
- classpath:/ : classpath的根目錄
加載順序為上文的排列順序,高優先級配置的屬性會生效
外部配置加載順序
通過官網檢視外部屬性加載順序:
https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html
這裡面一共有14個配置位置,加載順序由上到下