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

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

Introduction

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

Prototype

public JsonSerializer() 

Source Link

Usage

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

@Before
public void init() {
    entity = new DummyEntity();
    entity.intValue = 19;/*from w w w. j ava2 s. co 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);
}