|
26 | 26 | import org.junit.jupiter.api.Test;
|
27 | 27 |
|
28 | 28 | import org.springframework.boot.cloud.CloudPlatform;
|
| 29 | +import org.springframework.boot.context.config.ConfigData.Option; |
29 | 30 | import org.springframework.boot.context.config.ConfigDataEnvironmentContributor.ImportPhase;
|
30 | 31 | import org.springframework.boot.context.config.ConfigDataEnvironmentContributor.Kind;
|
31 | 32 | import org.springframework.boot.context.properties.bind.Binder;
|
@@ -334,6 +335,17 @@ void bindWhenHasUseLegacyPropertyThrowsException() {
|
334 | 335 | () -> createBoundContributor(null, new ConfigData(Collections.singleton(propertySource)), 0));
|
335 | 336 | }
|
336 | 337 |
|
| 338 | + @Test // gh-25029 |
| 339 | + void withBoundPropertiesWhenIgnoringImportsAndNothingBound() { |
| 340 | + TestResource resource = new TestResource("a"); |
| 341 | + ConfigData configData = new ConfigData(Collections.singleton(new MockPropertySource()), Option.IGNORE_IMPORTS); |
| 342 | + ConfigDataEnvironmentContributor contributor = ConfigDataEnvironmentContributor.ofUnboundImport(TEST_LOCATION, |
| 343 | + resource, false, configData, 0); |
| 344 | + Binder binder = new Binder(contributor.getConfigurationPropertySource()); |
| 345 | + ConfigDataEnvironmentContributor bound = contributor.withBoundProperties(binder); |
| 346 | + assertThat(bound).isNotNull(); |
| 347 | + } |
| 348 | + |
337 | 349 | private ConfigDataEnvironmentContributor createBoundContributor(String location) {
|
338 | 350 | return createBoundContributor(new TestResource(location),
|
339 | 351 | new ConfigData(Collections.singleton(new MockPropertySource())), 0);
|
|
0 commit comments