diff --git a/core/spring-boot/src/main/java/org/springframework/boot/logging/structured/ContextPairs.java b/core/spring-boot/src/main/java/org/springframework/boot/logging/structured/ContextPairs.java index 75c268d7201..f45465fa05c 100644 --- a/core/spring-boot/src/main/java/org/springframework/boot/logging/structured/ContextPairs.java +++ b/core/spring-boot/src/main/java/org/springframework/boot/logging/structured/ContextPairs.java @@ -138,7 +138,8 @@ public class ContextPairs { */ @SuppressWarnings("NullAway") // Doesn't detect lambda with correct nullability public void addMapEntries(Function> extractor) { - add(extractor.andThen(Map::entrySet), Map.Entry::getKey, Map.Entry::getValue); + Function>> elementsExtractor = extractor.andThen(Map::entrySet); + add(elementsExtractor, Map.Entry::getKey, Map.Entry::getValue); } /**