Example usage for org.springframework.kafka.support.serializer JsonDeserializer JsonDeserializer

List of usage examples for org.springframework.kafka.support.serializer JsonDeserializer JsonDeserializer

Introduction

In this page you can find the example usage for org.springframework.kafka.support.serializer JsonDeserializer JsonDeserializer.

Prototype

public JsonDeserializer() 

Source Link

Document

Construct an instance with a default ObjectMapper .

Usage

From source file:org.springframework.kafka.support.serializer.JsonSerializationTests.java

@Before
public void init() {
    entity = new DummyEntity();
    entity.intValue = 19;/*from   w  ww.j a v  a  2  s  . c  o m*/
    entity.longValue = 7L;
    entity.stringValue = "dummy";
    List<String> list = Arrays.asList("dummy1", "dummy2");
    entity.complexStruct = new HashMap<>();
    entity.complexStruct.put((short) 4, list);

    topic = "topic-name";

    jsonReader = new JsonDeserializer<DummyEntity>() {
    };
    jsonReader.configure(new HashMap<String, Object>(), false);
    jsonReader.close(); // does nothing, so may be called any time, or not called at all
    jsonWriter = new JsonSerializer<>();
    jsonWriter.configure(new HashMap<String, Object>(), false);
    jsonWriter.close(); // does nothing, so may be called any time, or not called at all
    stringReader = new StringDeserializer();
    stringReader.configure(new HashMap<String, Object>(), false);
    stringWriter = new StringSerializer();
    stringWriter.configure(new HashMap<String, Object>(), false);
}