Spring Cloud Config 中属性的加载优先级是多少?
Spring对外化配置的加载有明确的顺序。
- Devtools 全局设置属性位于主目录上(~/.spring-boot-devtools.properties,当 devtools 处于活动状态时)。
- 在测试上@TestPropertySource注释。
- @SpringBootTest#属性批注特性测试。
- 命令行参数。
- SPRING_APPLICATION_JSON的属性(嵌入在环境变量或系统属性中的内联 JSON)。
- ServletConfig init parameters.
- ServletContext init parameters.
- 来自 java:comp/env 的 JNDI 属性。
- Java System properties (System.getProperties())。
- 操作系统环境变量。
- 一个 RandomValuePropertySource,它的属性仅以 random.*为单位。
- 打包 jar 外部特定于配置文件的应用程序属性(application-{profile}.properties 和 YAML 变体)。
- 特定于配置文件的应用程序属性打包在 jar 中(application-{profile}.properties 和 YAML 变体)。
- 打包 jar 外部的应用程序属性(application.properties 和 YAML 变体)。
- 打包在 jar 中的应用程序属性(application.properties 和 YAML 变体)。
- @PropertySource@Configuration类的注释。
- 默认属性(通过设置 SpringApplication.setDefaultProperties 指定)。
但是,对于来自Spring Cloud Config的配置,似乎有一个明显的遗漏。有谁知道Spring Cloud Config适合上面的位置吗?