所有配置文件按以下顺序考虑: 优先级从低到高
1. 打包在jar中配置文件
2. 打包在jar中profile
3. 打包的jar之外的配置文件
4. 打包的jar之外的profile
java ‐jar configuration_file‐0.0.1‐SNAPSHOT.jar
jar包之外的配置文件 yml‐‐>yaml‐‐>properties
optional:classpath:/config/ yml‐‐>yaml‐‐>properties
optional:classpath:/ yml‐‐>yaml‐‐>properties
java ‐jar configuration_file‐0.0.1‐SNAPSHOT.jar ‐‐spring.profiles.active=dev
jar包之外的配置文件 profile‐dev ‐‐> yml‐‐>yaml‐‐>properties
optional:classpath:/config/ profile‐dev ‐‐> yml‐‐>yaml‐‐>properties
optional:classpath:/ profile‐dev ‐‐> yml‐‐>yaml‐‐>properties
java ‐jar configuration_file‐0.0.1‐SNAPSHOT.jar ‐‐spring.config.location=D:/application.properties
优先级最大, 因为指定了具体的配置文件。 所以不会和默认的约定配置文件进行互补