mirror of
https://github.com/spring-projects/spring-boot.git
synced 2026-10-10 03:19:01 +00:00
Suppress Jackson deprecation warnings for Spring Kafka
See gh-45535
This commit is contained in:
+4
-2
@@ -27,16 +27,18 @@ import org.apache.kafka.streams.kstream.Produced;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.kafka.annotation.EnableKafkaStreams;
|
||||
import org.springframework.kafka.support.serializer.JsonSerde;
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@EnableKafkaStreams
|
||||
public class MyKafkaStreamsConfiguration {
|
||||
|
||||
@Bean
|
||||
@SuppressWarnings("removal")
|
||||
public KStream<Integer, String> kStream(StreamsBuilder streamsBuilder) {
|
||||
KStream<Integer, String> stream = streamsBuilder.stream("ks1In");
|
||||
stream.map(this::uppercaseValue).to("ks1Out", Produced.with(Serdes.Integer(), new JsonSerde<>()));
|
||||
stream.map(this::uppercaseValue)
|
||||
.to("ks1Out",
|
||||
Produced.with(Serdes.Integer(), new org.springframework.kafka.support.serializer.JsonSerde<>()));
|
||||
return stream;
|
||||
}
|
||||
|
||||
|
||||
+3
-2
@@ -24,7 +24,6 @@ import org.apache.kafka.streams.kstream.Produced
|
||||
import org.springframework.context.annotation.Bean
|
||||
import org.springframework.context.annotation.Configuration
|
||||
import org.springframework.kafka.annotation.EnableKafkaStreams
|
||||
import org.springframework.kafka.support.serializer.JsonSerde
|
||||
|
||||
@Suppress("UNUSED_PARAMETER")
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@@ -32,9 +31,11 @@ import org.springframework.kafka.support.serializer.JsonSerde
|
||||
class MyKafkaStreamsConfiguration {
|
||||
|
||||
@Bean
|
||||
@Suppress("DEPRECATION")
|
||||
fun kStream(streamsBuilder: StreamsBuilder): KStream<Int, String> {
|
||||
val stream = streamsBuilder.stream<Int, String>("ks1In")
|
||||
stream.map(this::uppercaseValue).to("ks1Out", Produced.with(Serdes.Integer(), JsonSerde()))
|
||||
stream.map(this::uppercaseValue).to("ks1Out", Produced.with(Serdes.Integer(),
|
||||
org.springframework.kafka.support.serializer.JsonSerde()))
|
||||
return stream
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user