diff --git a/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/MapBinder.java b/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/MapBinder.java index abb657a2e79..42bc614637b 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/MapBinder.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/MapBinder.java @@ -103,8 +103,8 @@ class MapBinder extends AggregateBinder> { ConfigurationPropertyName entryName = getEntryName(source, name); Object key = getContext().getConversionService() .convert(getKeyName(entryName), this.keyType); - Object value = this.elementBinder.bind(entryName, valueBindable); - map.putIfAbsent(key, value); + map.computeIfAbsent(key, + (k) -> this.elementBinder.bind(entryName, valueBindable)); } } }