Add spring.config.import to config sample. Fixes #2841

This commit is contained in:
Ryan Baxter
2025-05-05 20:01:21 -04:00
parent 9ae48f4929
commit 0c48693739
2 changed files with 10 additions and 1 deletions

View File

@@ -7,3 +7,8 @@ logging:
levels:
org.springframework.boot.env.PropertySourcesLoader: TRACE
org.springframework.web: DEBUG
spring:
application:
name: bar
config:
import: "optional:configserver:"

View File

@@ -16,6 +16,7 @@
package sample;
import java.io.File;
import java.util.Map;
import org.junit.jupiter.api.AfterAll;
@@ -57,8 +58,11 @@ public class ConfigDataOrderingIntegrationTests {
@BeforeAll
public static void startConfigServer() {
String testResourcesDir = new File("src/test/resources").getAbsolutePath();
server = SpringApplication.run(org.springframework.cloud.config.server.test.TestConfigServerApplication.class,
"--spring.profiles.active=native", "--server.port=" + configPort, "--spring.config.name=server");
"--spring.profiles.active=native", "--server.port=" + configPort, "--spring.config.name=server",
"--spring.cloud.config.server.native.search-locations=file://" + testResourcesDir + ",file://"
+ testResourcesDir + "/config");
System.setProperty("spring.cloud.config.uri", "http://localhost:" + configPort);
}