A recent change in Spring Cloud Config 4.0.3 6ec9c432cb2c02840b85fdd8bcd0859eabc0ba46 now causes the ConfigClientProperties to bind before Spring Boot has loaded classpath:application.yml.
example/pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>example-application</artifactId>
<version>1.0-SNAPSHOT</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.1.0</version>
</parent>
<properties>
<java.version>17</java.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>2022.0.3</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
example/src/main/java/com/example/application/ExampleApplication.java
package com.example.application;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class ExampleApplication {
public static void main(String[] args) {
SpringApplication.run(ExampleApplication.class, args);
}
}
example/src/main/resources/application.yml
spring:
cloud:
config:
label: customlabel
example/application.yml
spring:
config:
import: 'configserver:'
Running the example above will show the ConfigClientProperties bind with no property values, this works as expected in Spring Cloud Config 4.0.2.
TheConfigServerConfigDataLocationResolver.resolve() method now calls resolveProfileSpecific() and binds ConfigClientProperties while ConfigDataEnvironmentContributors are still processing.
A recent change in Spring Cloud Config 4.0.3 6ec9c432cb2c02840b85fdd8bcd0859eabc0ba46 now causes the ConfigClientProperties to bind before Spring Boot has loaded
classpath:application.yml.example/pom.xml
example/src/main/java/com/example/application/ExampleApplication.java
example/src/main/resources/application.yml
example/application.yml
Running the example above will show the ConfigClientProperties bind with no property values, this works as expected in Spring Cloud Config 4.0.2.
TheConfigServerConfigDataLocationResolver.resolve() method now calls resolveProfileSpecific() and binds ConfigClientProperties while ConfigDataEnvironmentContributors are still processing.