diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigDataEnvironmentContributor.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigDataEnvironmentContributor.java index c53265dec4..1f5c9365e0 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigDataEnvironmentContributor.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigDataEnvironmentContributor.java @@ -223,7 +223,7 @@ class ConfigDataEnvironmentContributor implements Iterable createBoundContributor(null, new ConfigData(Collections.singleton(propertySource)), 0)); } + @Test // gh-25029 + void withBoundPropertiesWhenIgnoringImportsAndNothingBound() { + TestResource resource = new TestResource("a"); + ConfigData configData = new ConfigData(Collections.singleton(new MockPropertySource()), Option.IGNORE_IMPORTS); + ConfigDataEnvironmentContributor contributor = ConfigDataEnvironmentContributor.ofUnboundImport(TEST_LOCATION, + resource, false, configData, 0); + Binder binder = new Binder(contributor.getConfigurationPropertySource()); + ConfigDataEnvironmentContributor bound = contributor.withBoundProperties(binder); + assertThat(bound).isNotNull(); + } + private ConfigDataEnvironmentContributor createBoundContributor(String location) { return createBoundContributor(new TestResource(location), new ConfigData(Collections.singleton(new MockPropertySource())), 0);