Skip to content

Commit 1a0f219

Browse files
committed
Fix tests
Fixes gh-3832
1 parent 00430ac commit 1a0f219

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

spring-boot/src/main/java/org/springframework/boot/context/properties/bind/handler/NoUnboundElementsBindHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ private void checkNoUnboundElements(ConfigurationPropertyName name,
7777
BindContext context) {
7878
Set<ConfigurationProperty> unbound = new TreeSet<>();
7979
for (ConfigurationPropertySource source : context.getSources()) {
80-
if (this.filter.apply(source)) {
80+
if (source instanceof IterableConfigurationPropertySource && this.filter.apply(source)) {
8181
collectUnbound(name, unbound,
8282
(IterableConfigurationPropertySource) source);
8383
}

spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessorTests.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
import org.springframework.core.env.ConfigurableEnvironment;
4949
import org.springframework.core.env.MapPropertySource;
5050
import org.springframework.core.env.MutablePropertySources;
51+
import org.springframework.core.env.StandardEnvironment;
5152
import org.springframework.core.env.SystemEnvironmentPropertySource;
5253
import org.springframework.mock.env.MockEnvironment;
5354
import org.springframework.test.context.support.TestPropertySourceUtils;
@@ -426,7 +427,7 @@ public void unboundElementsFromSystemEnvironmentShouldNotThrowException() throws
426427
MutablePropertySources propertySources = env.getPropertySources();
427428
propertySources.addFirst(new MapPropertySource("test",
428429
Collections.singletonMap("com.example.foo", 5)));
429-
propertySources.addLast(new SystemEnvironmentPropertySource("system",
430+
propertySources.addLast(new SystemEnvironmentPropertySource(StandardEnvironment.SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME,
430431
Collections.singletonMap("COM_EXAMPLE_OTHER", "10")));
431432
this.context.register(TestConfiguration.class);
432433
this.context.refresh();

0 commit comments

Comments
 (0)