You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently a `byte[]` gets converted to a String using an
`ArrayToStringConverter`, which is not very useful.
Add a `BytesToStringConverter`.
* Remove obsolete getter.
Copy file name to clipboardExpand all lines: spring-kafka/src/main/java/org/springframework/kafka/annotation/KafkaListenerAnnotationBeanPostProcessor.java
+35-1Lines changed: 35 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -17,6 +17,8 @@
17
17
packageorg.springframework.kafka.annotation;
18
18
19
19
importjava.lang.reflect.Method;
20
+
importjava.nio.charset.Charset;
21
+
importjava.nio.charset.StandardCharsets;
20
22
importjava.util.ArrayList;
21
23
importjava.util.Arrays;
22
24
importjava.util.Collection;
@@ -152,6 +154,8 @@ public class KafkaListenerAnnotationBeanPostProcessor<K, V>
152
154
153
155
privateBeanExpressionContextexpressionContext;
154
156
157
+
privateCharsetcharset = StandardCharsets.UTF_8;
158
+
155
159
@Override
156
160
publicintgetOrder() {
157
161
returnLOWEST_PRECEDENCE;
@@ -204,6 +208,16 @@ public void setBeanFactory(BeanFactory beanFactory) {
204
208
}
205
209
}
206
210
211
+
/**
212
+
* Set a charset to use when converting byte[] to String in method arguments.
213
+
* Default UTF-8.
214
+
* @param charset the charset.
215
+
* @since 2.2
216
+
*/
217
+
publicvoidsetCharset(Charsetcharset) {
218
+
Assert.notNull(charset, "'charset' cannot be null");
0 commit comments