diff --git a/spring-kafka/src/main/java/org/springframework/kafka/annotation/KafkaListenerAnnotationBeanPostProcessor.java b/spring-kafka/src/main/java/org/springframework/kafka/annotation/KafkaListenerAnnotationBeanPostProcessor.java index 00a0889cef..e4bca3a91e 100644 --- a/spring-kafka/src/main/java/org/springframework/kafka/annotation/KafkaListenerAnnotationBeanPostProcessor.java +++ b/spring-kafka/src/main/java/org/springframework/kafka/annotation/KafkaListenerAnnotationBeanPostProcessor.java @@ -30,6 +30,7 @@ import java.util.HashMap; import java.util.HashSet; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.Properties; import java.util.Set; @@ -1014,7 +1015,7 @@ else if (resolvedValue instanceof Integer intgr) { private TopicPartitionOffset.SeekPosition resloveTopicPartitionOffsetSeekPosition(@Nullable Object seekPosition) { TopicPartitionOffset.SeekPosition resloveTpoSp = null; if (seekPosition instanceof String seekPositionName) { - String capitalLetterSeekPositionName = seekPositionName.trim().toUpperCase(); + String capitalLetterSeekPositionName = seekPositionName.trim().toUpperCase(Locale.ROOT); if (SeekPosition.BEGINNING.name().equals(capitalLetterSeekPositionName)) { resloveTpoSp = SeekPosition.BEGINNING; } diff --git a/spring-kafka/src/main/java/org/springframework/kafka/support/AbstractKafkaHeaderMapper.java b/spring-kafka/src/main/java/org/springframework/kafka/support/AbstractKafkaHeaderMapper.java index 03f655b299..186a2f78b9 100644 --- a/spring-kafka/src/main/java/org/springframework/kafka/support/AbstractKafkaHeaderMapper.java +++ b/spring-kafka/src/main/java/org/springframework/kafka/support/AbstractKafkaHeaderMapper.java @@ -24,6 +24,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.Set; import java.util.stream.Collectors; @@ -351,13 +352,13 @@ protected SimplePatternBasedHeaderMatcher(String pattern) { SimplePatternBasedHeaderMatcher(String pattern, boolean negate) { Assert.notNull(pattern, "Pattern must no be null"); - this.pattern = pattern.toLowerCase(); + this.pattern = pattern.toLowerCase(Locale.ROOT); this.negate = negate; } @Override public boolean matchHeader(String headerName) { - String header = headerName.toLowerCase(); + String header = headerName.toLowerCase(Locale.ROOT); if (PatternMatchUtils.simpleMatch(this.pattern, header)) { LOGGER.debug(() -> MessageFormat.format(