官网:https://docs.spring.io/spring-boot/docs/2.1.15.RELEASE/reference/html/
官方指明的位置
加载位置:
< – 例如命令行参数后接 --server.port = 8807 多个指定间接空格 --server.servlet.context-path=/springboot – >1.命令行参数2.来自java:comp/env的JNDI属性 3.Java系统属性(System.getProperties()) 4.操作系统环境变量 5.RandomValuePropertySource配置的random.*属性值
<–优先加载带profile的–><–从jar包外向jar包内寻找–>6.jar包外部的application-{profile}.properties或application.yml(带spring.profile)配置文件7.jar包内部的application-{profile}.properties或application.yml(带spring.profile)配置文件<–再来加载不带profile的–>8.jar包外部的application.properties或application.yml(不带spring.profile)配置文件9.jar包内部的application.properties或application.yml(不带spring.profile)配置文件10.@Configuration注解类上的@PropertySource 11.通过SpringApplication.setDefaultProperties指定的默认属性
同样具有优先级从到到底以及互补配置效果