From d9d206a761d49aa216cd114d7d897326432b14d4 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Sat, 22 Mar 2025 22:05:29 -0700 Subject: [PATCH] Bypass `SystemEnvironmentPropertySource.resolvePropertyName` Update `ConfigurationPropertySource` adapters so accessing the `SystemEnvironmentPropertySource` is handled by directly calling the source. This saves potentially expensive calls to `resolvePropertyName` which are unnecessary since mappings are handled directly. Closes gh-44862 --- .../MapConfigurationPropertySource.java | 2 +- .../SpringConfigurationPropertySource.java | 50 ++++++--- ...ngIterableConfigurationPropertySource.java | 100 +++++++++++------- ...pringConfigurationPropertySourceTests.java | 13 ++- ...rableConfigurationPropertySourceTests.java | 26 ++--- 5 files changed, 116 insertions(+), 75 deletions(-) diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/MapConfigurationPropertySource.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/MapConfigurationPropertySource.java index ae7e1c89e0..87fa56a90b 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/MapConfigurationPropertySource.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/MapConfigurationPropertySource.java @@ -56,7 +56,7 @@ public class MapConfigurationPropertySource implements IterableConfigurationProp public MapConfigurationPropertySource(Map map) { this.source = new LinkedHashMap<>(); MapPropertySource mapPropertySource = new MapPropertySource("source", this.source); - this.delegate = new SpringIterableConfigurationPropertySource(mapPropertySource, DEFAULT_MAPPERS); + this.delegate = new SpringIterableConfigurationPropertySource(mapPropertySource, false, DEFAULT_MAPPERS); putAll(map); } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/SpringConfigurationPropertySource.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/SpringConfigurationPropertySource.java index c13d3c56b8..7065a72a95 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/SpringConfigurationPropertySource.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/SpringConfigurationPropertySource.java @@ -59,17 +59,22 @@ class SpringConfigurationPropertySource implements ConfigurationPropertySource { private final PropertySource propertySource; + private final boolean systemEnvironmentSource; + private final PropertyMapper[] mappers; /** * Create a new {@link SpringConfigurationPropertySource} implementation. * @param propertySource the source property source + * @param systemEnvironmentSource if the source is from the system environment * @param mappers the property mappers */ - SpringConfigurationPropertySource(PropertySource propertySource, PropertyMapper... mappers) { + SpringConfigurationPropertySource(PropertySource propertySource, boolean systemEnvironmentSource, + PropertyMapper... mappers) { Assert.notNull(propertySource, "'propertySource' must not be null"); Assert.isTrue(mappers.length > 0, "'mappers' must contain at least one item"); this.propertySource = propertySource; + this.systemEnvironmentSource = systemEnvironmentSource; this.mappers = mappers; } @@ -81,7 +86,7 @@ class SpringConfigurationPropertySource implements ConfigurationPropertySource { for (PropertyMapper mapper : this.mappers) { try { for (String candidate : mapper.map(name)) { - Object value = getPropertySource().getProperty(candidate); + Object value = getPropertySourceProperty(candidate); if (value != null) { Origin origin = PropertySourceOrigin.get(this.propertySource, candidate); return ConfigurationProperty.of(this, name, value, origin); @@ -95,6 +100,18 @@ class SpringConfigurationPropertySource implements ConfigurationPropertySource { return null; } + protected final Object getPropertySourceProperty(String name) { + // Save calls to SystemEnvironmentPropertySource.resolvePropertyName(...) + // since we've already done the mapping + PropertySource propertySource = getPropertySource(); + return (!this.systemEnvironmentSource) ? propertySource.getProperty(name) + : getSystemEnvironmentProperty(((SystemEnvironmentPropertySource) propertySource).getSource(), name); + } + + Object getSystemEnvironmentProperty(Map systemEnvironment, String name) { + return systemEnvironment.get(name); + } + @Override public ConfigurationPropertyState containsDescendantOf(ConfigurationPropertyName name) { PropertySource source = getPropertySource(); @@ -127,6 +144,10 @@ class SpringConfigurationPropertySource implements ConfigurationPropertySource { return this.propertySource; } + protected final boolean isSystemEnvironmentSource() { + return this.systemEnvironmentSource; + } + protected final PropertyMapper[] getMappers() { return this.mappers; } @@ -145,24 +166,19 @@ class SpringConfigurationPropertySource implements ConfigurationPropertySource { */ static SpringConfigurationPropertySource from(PropertySource source) { Assert.notNull(source, "'source' must not be null"); - PropertyMapper[] mappers = getPropertyMappers(source); - if (isFullEnumerable(source)) { - return new SpringIterableConfigurationPropertySource((EnumerablePropertySource) source, mappers); - } - return new SpringConfigurationPropertySource(source, mappers); + boolean systemEnvironmentSource = isSystemEnvironmentPropertySource(source); + PropertyMapper[] mappers = (!systemEnvironmentSource) ? DEFAULT_MAPPERS : SYSTEM_ENVIRONMENT_MAPPERS; + return (!isFullEnumerable(source)) + ? new SpringConfigurationPropertySource(source, systemEnvironmentSource, mappers) + : new SpringIterableConfigurationPropertySource((EnumerablePropertySource) source, + systemEnvironmentSource, mappers); } - private static PropertyMapper[] getPropertyMappers(PropertySource source) { - if (source instanceof SystemEnvironmentPropertySource && hasSystemEnvironmentName(source)) { - return SYSTEM_ENVIRONMENT_MAPPERS; - } - return DEFAULT_MAPPERS; - } - - private static boolean hasSystemEnvironmentName(PropertySource source) { + private static boolean isSystemEnvironmentPropertySource(PropertySource source) { String name = source.getName(); - return StandardEnvironment.SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME.equals(name) - || name.endsWith("-" + StandardEnvironment.SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME); + return (source instanceof SystemEnvironmentPropertySource) + && (StandardEnvironment.SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME.equals(name) + || name.endsWith("-" + StandardEnvironment.SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME)); } private static boolean isFullEnumerable(PropertySource source) { diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/SpringIterableConfigurationPropertySource.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/SpringIterableConfigurationPropertySource.java index d1e5f63daf..f597017d8b 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/SpringIterableConfigurationPropertySource.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/SpringIterableConfigurationPropertySource.java @@ -19,6 +19,7 @@ package org.springframework.boot.context.properties.source; import java.util.Arrays; import java.util.Collections; import java.util.ConcurrentModificationException; +import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedHashMap; @@ -27,7 +28,6 @@ import java.util.NoSuchElementException; import java.util.Objects; import java.util.Set; import java.util.function.BiPredicate; -import java.util.function.Supplier; import java.util.stream.Stream; import org.springframework.boot.origin.Origin; @@ -59,11 +59,13 @@ class SpringIterableConfigurationPropertySource extends SpringConfigurationPrope private volatile ConfigurationPropertyName[] configurationPropertyNames; - SpringIterableConfigurationPropertySource(EnumerablePropertySource propertySource, PropertyMapper... mappers) { - super(propertySource, mappers); + SpringIterableConfigurationPropertySource(EnumerablePropertySource propertySource, + boolean systemEnvironmentSource, PropertyMapper... mappers) { + super(propertySource, systemEnvironmentSource, mappers); assertEnumerablePropertySource(); + boolean immutable = isImmutablePropertySource(); this.ancestorOfCheck = getAncestorOfCheck(mappers); - this.cache = new SoftReferenceConfigurationPropertyCache<>(isImmutablePropertySource()); + this.cache = new SoftReferenceConfigurationPropertyCache<>(immutable); } private BiPredicate getAncestorOfCheck( @@ -102,7 +104,7 @@ class SpringIterableConfigurationPropertySource extends SpringConfigurationPrope return configurationProperty; } for (String candidate : getCache().getMapped(name)) { - Object value = getPropertySource().getProperty(candidate); + Object value = getPropertySourceProperty(candidate); if (value != null) { Origin origin = PropertySourceOrigin.get(getPropertySource(), candidate); return ConfigurationProperty.of(this, name, value, origin); @@ -111,6 +113,11 @@ class SpringIterableConfigurationPropertySource extends SpringConfigurationPrope return null; } + @Override + protected Object getSystemEnvironmentProperty(Map systemEnvironment, String name) { + return getCache().getSystemEnvironmentProperty(name); + } + @Override public Stream stream() { ConfigurationPropertyName[] names = getConfigurationPropertyNames(); @@ -129,7 +136,14 @@ class SpringIterableConfigurationPropertySource extends SpringConfigurationPrope return result; } if (this.ancestorOfCheck == PropertyMapper.DEFAULT_ANCESTOR_OF_CHECK) { - return getCache().containsDescendantOf(name, this.ancestorOfCheck); + Set descendants = getCache().getDescendants(); + if (descendants != null) { + if (name.isEmpty() && !descendants.isEmpty()) { + return ConfigurationPropertyState.PRESENT; + } + return !descendants.contains(name) ? ConfigurationPropertyState.ABSENT + : ConfigurationPropertyState.PRESENT; + } } ConfigurationPropertyName[] candidates = getConfigurationPropertyNames(); for (ConfigurationPropertyName candidate : candidates) { @@ -158,12 +172,13 @@ class SpringIterableConfigurationPropertySource extends SpringConfigurationPrope } private Cache createCache() { - return new Cache(getMappers(), isImmutablePropertySource(), - this.ancestorOfCheck == PropertyMapper.DEFAULT_ANCESTOR_OF_CHECK); + boolean immutable = isImmutablePropertySource(); + boolean captureDescendants = this.ancestorOfCheck == PropertyMapper.DEFAULT_ANCESTOR_OF_CHECK; + return new Cache(getMappers(), immutable, captureDescendants, isSystemEnvironmentSource()); } private Cache updateCache(Cache cache) { - cache.update(getPropertySource()::getPropertyNames); + cache.update(getPropertySource()); return cache; } @@ -193,20 +208,24 @@ class SpringIterableConfigurationPropertySource extends SpringConfigurationPrope private final boolean captureDescendants; + private final boolean systemEnvironmentSource; + private volatile Data data; - Cache(PropertyMapper[] mappers, boolean immutable, boolean captureDescendants) { + Cache(PropertyMapper[] mappers, boolean immutable, boolean captureDescendants, + boolean systemEnvironmentSource) { this.mappers = mappers; this.immutable = immutable; this.captureDescendants = captureDescendants; + this.systemEnvironmentSource = systemEnvironmentSource; } - void update(Supplier propertyNames) { + void update(EnumerablePropertySource propertySource) { if (this.data == null || !this.immutable) { int count = 0; while (true) { try { - tryUpdate(propertyNames.get()); + tryUpdate(propertySource); return; } catch (ConcurrentModificationException ex) { @@ -218,9 +237,10 @@ class SpringIterableConfigurationPropertySource extends SpringConfigurationPrope } } - private void tryUpdate(String[] propertyNames) { + private void tryUpdate(EnumerablePropertySource propertySource) { Data data = this.data; String[] lastUpdated = (data != null) ? data.lastUpdated() : null; + String[] propertyNames = propertySource.getPropertyNames(); if (lastUpdated != null && Arrays.equals(lastUpdated, propertyNames)) { return; } @@ -229,8 +249,9 @@ class SpringIterableConfigurationPropertySource extends SpringConfigurationPrope (data != null) ? data.mappings() : null, size); Map reverseMappings = cloneOrCreate( (data != null) ? data.reverseMappings() : null, size); - Map> descendants = cloneOrCreate( - (data != null) ? data.descendants() : null, size); + Set descendants = (!this.captureDescendants) ? null : new HashSet<>(); + Map systemEnvironmentCopy = (!this.systemEnvironmentSource) ? null + : copySource(propertySource); for (PropertyMapper propertyMapper : this.mappers) { for (String propertyName : propertyNames) { if (!reverseMappings.containsKey(propertyName)) { @@ -238,9 +259,7 @@ class SpringIterableConfigurationPropertySource extends SpringConfigurationPrope if (configurationPropertyName != null && !configurationPropertyName.isEmpty()) { add(mappings, configurationPropertyName, propertyName); reverseMappings.put(propertyName, configurationPropertyName); - if (this.captureDescendants) { - addParents(descendants, configurationPropertyName); - } + addParents(descendants, configurationPropertyName); } } } @@ -248,18 +267,28 @@ class SpringIterableConfigurationPropertySource extends SpringConfigurationPrope ConfigurationPropertyName[] configurationPropertyNames = this.immutable ? reverseMappings.values().toArray(new ConfigurationPropertyName[0]) : null; lastUpdated = this.immutable ? null : propertyNames; - this.data = new Data(mappings, reverseMappings, descendants, configurationPropertyNames, lastUpdated); + this.data = new Data(mappings, reverseMappings, descendants, configurationPropertyNames, + systemEnvironmentCopy, lastUpdated); + } + + @SuppressWarnings("unchecked") + private HashMap copySource(EnumerablePropertySource propertySource) { + return new HashMap<>((Map) propertySource.getSource()); } private Map cloneOrCreate(Map source, int size) { return (source != null) ? new LinkedHashMap<>(source) : new LinkedHashMap<>(size); } - private void addParents(Map> descendants, - ConfigurationPropertyName name) { - ConfigurationPropertyName parent = name; + private void addParents(Set descendants, ConfigurationPropertyName name) { + if (descendants == null || name.isEmpty()) { + return; + } + ConfigurationPropertyName parent = name.getParent(); while (!parent.isEmpty()) { - add(descendants, parent, name); + if (!descendants.add(parent)) { + return; + } parent = parent.getParent(); } } @@ -289,25 +318,18 @@ class SpringIterableConfigurationPropertySource extends SpringConfigurationPrope return names; } - ConfigurationPropertyState containsDescendantOf(ConfigurationPropertyName name, - BiPredicate ancestorOfCheck) { - Data data = this.data; - if (name.isEmpty() && !data.descendants().isEmpty()) { - return ConfigurationPropertyState.PRESENT; - } - Set candidates = data.descendants().getOrDefault(name, Collections.emptySet()); - for (ConfigurationPropertyName candidate : candidates) { - if (ancestorOfCheck.test(name, candidate)) { - return ConfigurationPropertyState.PRESENT; - } - } - return ConfigurationPropertyState.ABSENT; + Set getDescendants() { + return this.data.descendants(); + } + + Object getSystemEnvironmentProperty(String name) { + return this.data.systemEnvironmentCopy().get(name); } private record Data(Map> mappings, - Map reverseMappings, - Map> descendants, - ConfigurationPropertyName[] configurationPropertyNames, String[] lastUpdated) { + Map reverseMappings, Set descendants, + ConfigurationPropertyName[] configurationPropertyNames, Map systemEnvironmentCopy, + String[] lastUpdated) { } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/SpringConfigurationPropertySourceTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/SpringConfigurationPropertySourceTests.java index 7971db9b82..7ea83f6ee4 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/SpringConfigurationPropertySourceTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/SpringConfigurationPropertySourceTests.java @@ -43,7 +43,7 @@ class SpringConfigurationPropertySourceTests { @Test void createWhenPropertySourceIsNullShouldThrowException() { assertThatIllegalArgumentException() - .isThrownBy(() -> new SpringConfigurationPropertySource(null, mock(PropertyMapper.class))) + .isThrownBy(() -> new SpringConfigurationPropertySource(null, false, mock(PropertyMapper.class))) .withMessageContaining("'propertySource' must not be null"); } @@ -57,7 +57,8 @@ class SpringConfigurationPropertySourceTests { TestPropertyMapper mapper = new TestPropertyMapper(); ConfigurationPropertyName name = ConfigurationPropertyName.of("my.key"); mapper.addFromConfigurationProperty(name, "key2"); - SpringConfigurationPropertySource adapter = new SpringConfigurationPropertySource(propertySource, mapper); + SpringConfigurationPropertySource adapter = new SpringConfigurationPropertySource(propertySource, false, + mapper); assertThat(adapter.getConfigurationProperty(name).getValue()).isEqualTo("value2"); } @@ -69,7 +70,8 @@ class SpringConfigurationPropertySourceTests { TestPropertyMapper mapper = new TestPropertyMapper(); ConfigurationPropertyName name = ConfigurationPropertyName.of("my.key"); mapper.addFromConfigurationProperty(name, "key"); - SpringConfigurationPropertySource adapter = new SpringConfigurationPropertySource(propertySource, mapper); + SpringConfigurationPropertySource adapter = new SpringConfigurationPropertySource(propertySource, false, + mapper); ConfigurationProperty configurationProperty = adapter.getConfigurationProperty(name); assertThat(configurationProperty.getOrigin()).hasToString("\"key\" from property source \"test\""); assertThat(configurationProperty.getSource()).isEqualTo(adapter); @@ -83,7 +85,8 @@ class SpringConfigurationPropertySourceTests { TestPropertyMapper mapper = new TestPropertyMapper(); ConfigurationPropertyName name = ConfigurationPropertyName.of("my.key"); mapper.addFromConfigurationProperty(name, "key"); - SpringConfigurationPropertySource adapter = new SpringConfigurationPropertySource(propertySource, mapper); + SpringConfigurationPropertySource adapter = new SpringConfigurationPropertySource(propertySource, false, + mapper); assertThat(adapter.getConfigurationProperty(name).getOrigin()).hasToString("TestOrigin key"); } @@ -92,7 +95,7 @@ class SpringConfigurationPropertySourceTests { Map source = new LinkedHashMap<>(); source.put("foo.bar", "value"); PropertySource propertySource = new MapPropertySource("test", source); - SpringConfigurationPropertySource adapter = new SpringConfigurationPropertySource(propertySource, + SpringConfigurationPropertySource adapter = new SpringConfigurationPropertySource(propertySource, false, DefaultPropertyMapper.INSTANCE); assertThat(adapter.containsDescendantOf(ConfigurationPropertyName.of("foo"))) .isEqualTo(ConfigurationPropertyState.UNKNOWN); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/SpringIterableConfigurationPropertySourceTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/SpringIterableConfigurationPropertySourceTests.java index de3df6d09d..0d44809834 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/SpringIterableConfigurationPropertySourceTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/SpringIterableConfigurationPropertySourceTests.java @@ -50,7 +50,7 @@ class SpringIterableConfigurationPropertySourceTests { @Test void createWhenPropertySourceIsNullShouldThrowException() { assertThatIllegalArgumentException() - .isThrownBy(() -> new SpringIterableConfigurationPropertySource(null, mock(PropertyMapper.class))) + .isThrownBy(() -> new SpringIterableConfigurationPropertySource(null, false, mock(PropertyMapper.class))) .withMessageContaining("'propertySource' must not be null"); } @@ -69,7 +69,7 @@ class SpringIterableConfigurationPropertySourceTests { TestPropertyMapper mapper2 = new TestPropertyMapper(); mapper2.addFromPropertySource("key2", "my.key2b"); SpringIterableConfigurationPropertySource adapter = new SpringIterableConfigurationPropertySource( - propertySource, mapper1, mapper2); + propertySource, false, mapper1, mapper2); assertThat(adapter.iterator()).toIterable() .extracting(Object::toString) .containsExactly("my.key1", "my.key2a", "my.key4"); @@ -86,7 +86,7 @@ class SpringIterableConfigurationPropertySourceTests { ConfigurationPropertyName name = ConfigurationPropertyName.of("my.key"); mapper.addFromConfigurationProperty(name, "key2"); SpringIterableConfigurationPropertySource adapter = new SpringIterableConfigurationPropertySource( - propertySource, mapper); + propertySource, false, mapper); assertThat(adapter.getConfigurationProperty(name).getValue()).isEqualTo("value2"); } @@ -101,7 +101,7 @@ class SpringIterableConfigurationPropertySourceTests { mapper.addFromPropertySource("key1", "my.missing"); mapper.addFromPropertySource("key2", "my.k-e-y"); SpringIterableConfigurationPropertySource adapter = new SpringIterableConfigurationPropertySource( - propertySource, mapper); + propertySource, false, mapper); ConfigurationPropertyName name = ConfigurationPropertyName.of("my.key"); assertThat(adapter.getConfigurationProperty(name).getValue()).isEqualTo("value2"); } @@ -115,7 +115,7 @@ class SpringIterableConfigurationPropertySourceTests { ConfigurationPropertyName name = ConfigurationPropertyName.of("my.key"); mapper.addFromConfigurationProperty(name, "key"); SpringIterableConfigurationPropertySource adapter = new SpringIterableConfigurationPropertySource( - propertySource, mapper); + propertySource, false, mapper); assertThat(adapter.getConfigurationProperty(name).getOrigin()) .hasToString("\"key\" from property source \"test\""); } @@ -130,7 +130,7 @@ class SpringIterableConfigurationPropertySourceTests { ConfigurationPropertyName name = ConfigurationPropertyName.of("my.key"); mapper.addFromConfigurationProperty(name, "key"); SpringIterableConfigurationPropertySource adapter = new SpringIterableConfigurationPropertySource( - propertySource, mapper); + propertySource, false, mapper); assertThat(adapter.getConfigurationProperty(name).getOrigin()).hasToString("TestOrigin key"); } @@ -142,7 +142,7 @@ class SpringIterableConfigurationPropertySourceTests { EnumerablePropertySource propertySource = new OriginCapablePropertySource<>( new MapPropertySource("test", source)); SpringIterableConfigurationPropertySource adapter = new SpringIterableConfigurationPropertySource( - propertySource, DefaultPropertyMapper.INSTANCE); + propertySource, false, DefaultPropertyMapper.INSTANCE); assertThat(adapter.containsDescendantOf(ConfigurationPropertyName.of("foo"))) .isEqualTo(ConfigurationPropertyState.PRESENT); assertThat(adapter.containsDescendantOf(ConfigurationPropertyName.of("faf"))) @@ -159,7 +159,7 @@ class SpringIterableConfigurationPropertySourceTests { SystemEnvironmentPropertySource propertySource = new SystemEnvironmentPropertySource( StandardEnvironment.SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME, source); SpringIterableConfigurationPropertySource adapter = new SpringIterableConfigurationPropertySource( - propertySource, SystemEnvironmentPropertyMapper.INSTANCE); + propertySource, true, SystemEnvironmentPropertyMapper.INSTANCE); assertThat(adapter.containsDescendantOf(ConfigurationPropertyName.of("foo.bar-baz"))) .isEqualTo(ConfigurationPropertyState.PRESENT); assertThat(adapter.containsDescendantOf(ConfigurationPropertyName.of("foo.alpha-bravo"))) @@ -175,7 +175,7 @@ class SpringIterableConfigurationPropertySourceTests { map.put("key1", "value1"); map.put("key2", "value2"); EnumerablePropertySource source = new MapPropertySource("test", map); - SpringIterableConfigurationPropertySource adapter = new SpringIterableConfigurationPropertySource(source, + SpringIterableConfigurationPropertySource adapter = new SpringIterableConfigurationPropertySource(source, false, DefaultPropertyMapper.INSTANCE); assertThat(adapter.stream()).hasSize(2); map.put("key3", "value3"); @@ -189,7 +189,7 @@ class SpringIterableConfigurationPropertySourceTests { map.put("key1", "value1"); map.put("key2", "value2"); EnumerablePropertySource source = new MapPropertySource("test", map); - SpringIterableConfigurationPropertySource adapter = new SpringIterableConfigurationPropertySource(source, + SpringIterableConfigurationPropertySource adapter = new SpringIterableConfigurationPropertySource(source, false, DefaultPropertyMapper.INSTANCE); assertThat(adapter.stream()).hasSize(2); map.setThrowException(true); @@ -204,7 +204,7 @@ class SpringIterableConfigurationPropertySourceTests { map.put("key1", "value1"); map.put("key2", "value2"); EnumerablePropertySource source = new OriginTrackedMapPropertySource("test", map); - SpringIterableConfigurationPropertySource adapter = new SpringIterableConfigurationPropertySource(source, + SpringIterableConfigurationPropertySource adapter = new SpringIterableConfigurationPropertySource(source, false, DefaultPropertyMapper.INSTANCE); assertThat(adapter.stream()).hasSize(2); map.put("key3", "value3"); @@ -218,7 +218,7 @@ class SpringIterableConfigurationPropertySourceTests { map.put("key1", "value1"); map.put("key2", "value2"); EnumerablePropertySource source = new OriginTrackedMapPropertySource("test", map, true); - SpringIterableConfigurationPropertySource adapter = new SpringIterableConfigurationPropertySource(source, + SpringIterableConfigurationPropertySource adapter = new SpringIterableConfigurationPropertySource(source, false, DefaultPropertyMapper.INSTANCE); assertThat(adapter.stream()).hasSize(2); map.put("key3", "value3"); @@ -234,7 +234,7 @@ class SpringIterableConfigurationPropertySourceTests { map.put("test.map.delta", "value4"); EnumerablePropertySource source = new OriginTrackedMapPropertySource("test", map, true); SpringIterableConfigurationPropertySource propertySource = new SpringIterableConfigurationPropertySource(source, - DefaultPropertyMapper.INSTANCE); + false, DefaultPropertyMapper.INSTANCE); assertThat(propertySource.stream().map(ConfigurationPropertyName::toString)).containsExactly("test.map.alpha", "test.map.bravo", "test.map.charlie", "test.map.delta"); }