Skip to content

Commit 12eb466

Browse files
committed
Polish 'Bind empty strings to empty maps'
See gh-50773
1 parent 485bd7c commit 12eb466

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

  • core/spring-boot/src

core/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/MapBinder.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@
3333
import org.springframework.boot.context.properties.source.IterableConfigurationPropertySource;
3434
import org.springframework.core.CollectionFactory;
3535
import org.springframework.core.ResolvableType;
36-
import org.springframework.util.ObjectUtils;
3736

3837
/**
3938
* {@link AggregateBinder} for Maps.
4039
*
4140
* @author Phillip Webb
4241
* @author Madhura Bhave
42+
* @author Ahmed El Amraouiyine
4343
*/
4444
class MapBinder extends AggregateBinder<Map<Object, Object>> {
4545

@@ -65,7 +65,7 @@ protected boolean isAllowRecursiveBinding(@Nullable ConfigurationPropertySource
6565
if (property != null) {
6666
getContext().setConfigurationProperty(property);
6767
Object result = getContext().getPlaceholdersResolver().resolvePlaceholders(property.getValue());
68-
if (ObjectUtils.isEmpty(result)) {
68+
if (result instanceof CharSequence charSequence && charSequence.isEmpty()) {
6969
return createMap(target);
7070
}
7171
return getContext().getConverter().convert(result, target);

core/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/MapBinderTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
*
6666
* @author Phillip Webb
6767
* @author Madhura Bhave
68+
* @author Ahmed El Amraouiyine
6869
*/
6970
class MapBinderTests {
7071

0 commit comments

Comments
 (0)