Skip to content

Commit fe0f58e

Browse files
garyrussellartembilan
authored andcommitted
JsonSerde Improvement
Narrow return types of `serializer()`, `deserializer()` to avoid casting if the user wants to programmatically customize the objects. **cherry-pick to 2.8.x**
1 parent 97d60b7 commit fe0f58e

File tree

1 file changed

+3
-5
lines changed
  • spring-kafka/src/main/java/org/springframework/kafka/support/serializer

1 file changed

+3
-5
lines changed

spring-kafka/src/main/java/org/springframework/kafka/support/serializer/JsonSerde.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2017-2021 the original author or authors.
2+
* Copyright 2017-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -18,9 +18,7 @@
1818

1919
import java.util.Map;
2020

21-
import org.apache.kafka.common.serialization.Deserializer;
2221
import org.apache.kafka.common.serialization.Serde;
23-
import org.apache.kafka.common.serialization.Serializer;
2422

2523
import org.springframework.core.ResolvableType;
2624
import org.springframework.kafka.support.JacksonUtils;
@@ -116,12 +114,12 @@ public void close() {
116114
}
117115

118116
@Override
119-
public Serializer<T> serializer() {
117+
public JsonSerializer<T> serializer() {
120118
return this.jsonSerializer;
121119
}
122120

123121
@Override
124-
public Deserializer<T> deserializer() {
122+
public JsonDeserializer<T> deserializer() {
125123
return this.jsonDeserializer;
126124
}
127125

0 commit comments

Comments
 (0)