1 package de.example.spring.kafka;
3 import org.springframework.messaging.converter.MappingJackson2MessageConverter;
4 import org.springframework.util.MimeType;
7 * Working around problem created by org.springframework.cloud.stream.binder.AbstractBinder.JavaClassMimeTypeConversion.mimeTypeFromObject()
10 * if (payload instanceof String) {
11 * return MimeTypeUtils.APPLICATION_JSON_VALUE.equals(originalContentType) ? MimeTypeUtils.APPLICATION_JSON
12 * : MimeTypeUtils.TEXT_PLAIN;
15 * Changes messages from:
16 * contentType "application/json;charset=UTF-8"{"name":"example message","description":"this is some description"}
19 * contentType "text/plain" originalContentType "application/json;charset=UTF-8"{"name":"example message","description":"this is some description"}
22 public class MyCustomMessageConverter extends MappingJackson2MessageConverter {
24 public MyCustomMessageConverter() {
25 super(new MimeType("application", "json"));