I created a Spring boot application that sends messages to Kafka queues (using spring integrations kafka support). I want to send arbitrary json-serialized objects.
Is there a way to get/inject a json-de-/serializer within my spring boot application? Or how to ad hoc de-/ serialize an object?
what are good practices to apply serialization?
Apache Kafka stores and transports Byte arrays in its topics. It ships with a number of built in (de)serializers but a JSON one is not included. Luckily, the Spring Kafka framework includes a support package that contains a JSON (de)serializer that uses a Jackson ObjectMapper under the covers.
You can add a config file like this
Replace
Operation
with your class which you want to deserialize.