1 package de.example.spring.kafka;
3 import java.nio.charset.Charset;
5 import org.springframework.messaging.converter.MappingJackson2MessageConverter;
6 import org.springframework.util.MimeType;
9 * Working around problem created by org.springframework.cloud.stream.binder.AbstractBinder.JavaClassMimeTypeConversion.mimeTypeFromObject()
12 * if (payload instanceof String) {
13 * return MimeTypeUtils.APPLICATION_JSON_VALUE.equals(originalContentType) ? MimeTypeUtils.APPLICATION_JSON
14 * : MimeTypeUtils.TEXT_PLAIN;
17 * Changes messages from:
18 * contentType "application/json;charset=UTF-8"{"name":"example message","description":"this is some description"}
21 * contentType "text/plain" originalContentType "application/json;charset=UTF-8"{"name":"example message","description":"this is some description"}
24 public class MyCustomMessageConverter extends MappingJackson2MessageConverter {
26 public MyCustomMessageConverter() {
27 super(new MimeType("application", "json"));