diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/CorrelationIdFormatter.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/CorrelationIdFormatter.java index 1388aecca0b..e701fba05cf 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/CorrelationIdFormatter.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/CorrelationIdFormatter.java @@ -22,8 +22,8 @@ import java.util.Collection; import java.util.Collections; import java.util.Iterator; import java.util.List; -import java.util.function.Function; import java.util.function.Predicate; +import java.util.function.UnaryOperator; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; @@ -84,7 +84,7 @@ public final class CorrelationIdFormatter { * @param resolver the resolver used to resolve named values * @return a formatted correlation id */ - public String format(Function resolver) { + public String format(UnaryOperator resolver) { StringBuilder result = new StringBuilder(); formatTo(resolver, result); return result.toString(); @@ -96,7 +96,7 @@ public final class CorrelationIdFormatter { * @param resolver the resolver used to resolve named values * @param appendable the appendable for the formatted correlation id */ - public void formatTo(Function resolver, Appendable appendable) { + public void formatTo(UnaryOperator resolver, Appendable appendable) { Predicate canResolve = (part) -> StringUtils.hasLength(resolver.apply(part.name())); try { if (this.parts.stream().anyMatch(canResolve)) { @@ -169,7 +169,7 @@ public final class CorrelationIdFormatter { private static final Pattern pattern = Pattern.compile("^(.+?)\\((\\d+)\\)$"); - String resolve(Function resolver) { + String resolve(UnaryOperator resolver) { String resolved = resolver.apply(name()); if (resolved == null) { return blank();