Skip to content

Commit 63833c5

Browse files
committed
Addressing deprecation warnings
Signed-off-by: Soby Chacko <[email protected]>
1 parent f9494b3 commit 63833c5

File tree

5 files changed

+14
-17
lines changed

5 files changed

+14
-17
lines changed

spring-kafka/src/main/java/org/springframework/kafka/aot/KafkaRuntimeHints.java

+1-3
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@
7474
*/
7575
public class KafkaRuntimeHints implements RuntimeHintsRegistrar {
7676

77-
@SuppressWarnings("deprecation")
7877
@Override
7978
public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader) {
8079
ReflectionHints reflectionHints = hints.reflection();
@@ -106,8 +105,7 @@ public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader)
106105
KafkaListenerAnnotationBeanPostProcessor.class)
107106
.forEach(type -> reflectionHints.registerType(type,
108107
builder -> builder.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS,
109-
MemberCategory.INVOKE_DECLARED_METHODS,
110-
MemberCategory.INTROSPECT_PUBLIC_METHODS)));
108+
MemberCategory.INVOKE_DECLARED_METHODS)));
111109

112110
Stream.of(
113111
KafkaBootstrapConfiguration.class,

spring-kafka/src/main/java/org/springframework/kafka/event/NonResponsiveConsumerEvent.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public class NonResponsiveConsumerEvent extends KafkaEvent {
4141

4242
private final String listenerId;
4343

44-
private final @Nullable List<TopicPartition> topicPartitions;
44+
private final transient @Nullable List<TopicPartition> topicPartitions;
4545

4646
private transient final Consumer<?, ?> consumer;
4747

spring-kafka/src/main/java/org/springframework/kafka/streams/RecoveringDeserializationExceptionHandler.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import org.apache.commons.logging.LogFactory;
2424
import org.apache.kafka.clients.consumer.ConsumerRecord;
2525
import org.apache.kafka.streams.errors.DeserializationExceptionHandler;
26-
import org.apache.kafka.streams.processor.ProcessorContext;
26+
import org.apache.kafka.streams.errors.ErrorHandlerContext;
2727
import org.jspecify.annotations.Nullable;
2828

2929
import org.springframework.kafka.listener.ConsumerRecordRecoverer;
@@ -56,7 +56,7 @@ public RecoveringDeserializationExceptionHandler(ConsumerRecordRecoverer recover
5656
}
5757

5858
@Override
59-
public DeserializationHandlerResponse handle(ProcessorContext context, ConsumerRecord<byte[], byte[]> record,
59+
public DeserializationHandlerResponse handle(ErrorHandlerContext context, ConsumerRecord<byte[], byte[]> record,
6060
Exception exception) {
6161

6262
if (this.recoverer == null) {

spring-kafka/src/test/java/org/springframework/kafka/listener/MockConsumerTests.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2023-2024 the original author or authors.
2+
* Copyright 2023-2025 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.
@@ -28,7 +28,6 @@
2828

2929
import org.apache.kafka.clients.consumer.ConsumerRecord;
3030
import org.apache.kafka.clients.consumer.MockConsumer;
31-
import org.apache.kafka.clients.consumer.OffsetResetStrategy;
3231
import org.apache.kafka.common.TopicPartition;
3332
import org.apache.kafka.common.header.internals.RecordHeaders;
3433
import org.apache.kafka.common.record.TimestampType;
@@ -87,7 +86,7 @@ public void foo(String in) {
8786

8887
@Bean
8988
public ConsumerFactory<String, String> consumerFactory() {
90-
MockConsumer<String, String> consumer = new MockConsumer<>(OffsetResetStrategy.EARLIEST);
89+
MockConsumer<String, String> consumer = new MockConsumer<>("earliest");
9190
TopicPartition topicPartition0 = new TopicPartition("foo", 0);
9291
TopicPartition topicPartition1 = new TopicPartition("foo", 1);
9392
TopicPartition topicPartition2 = new TopicPartition("foo", 2);

spring-kafka/src/test/java/org/springframework/kafka/streams/RecoveringDeserializationExceptionHandlerTests.java

+8-8
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
import org.apache.kafka.streams.StreamsBuilder;
3535
import org.apache.kafka.streams.StreamsConfig;
3636
import org.apache.kafka.streams.errors.DeserializationExceptionHandler.DeserializationHandlerResponse;
37+
import org.apache.kafka.streams.errors.ErrorHandlerContext;
3738
import org.apache.kafka.streams.kstream.KStream;
38-
import org.apache.kafka.streams.processor.ProcessorContext;
3939
import org.apache.kafka.streams.processor.WallclockTimestampExtractor;
4040
import org.junit.jupiter.api.Test;
4141

@@ -94,9 +94,9 @@ void viaStringProperty() {
9494
Recoverer.class.getName());
9595
handler.configure(configs);
9696
assertThat(KafkaTestUtils.getPropertyValue(handler, "recoverer")).isInstanceOf(Recoverer.class);
97-
assertThat(handler.handle((ProcessorContext) null, new ConsumerRecord<>("foo", 0, 0, null, null),
97+
assertThat(handler.handle((ErrorHandlerContext) null, new ConsumerRecord<>("foo", 0, 0, null, null),
9898
new IllegalArgumentException())).isEqualTo(DeserializationHandlerResponse.CONTINUE);
99-
assertThat(handler.handle((ProcessorContext) null, new ConsumerRecord<>("foo", 0, 0, null, null),
99+
assertThat(handler.handle((ErrorHandlerContext) null, new ConsumerRecord<>("foo", 0, 0, null, null),
100100
new IllegalStateException())).isEqualTo(DeserializationHandlerResponse.FAIL);
101101
}
102102

@@ -107,9 +107,9 @@ void viaClassProperty() {
107107
configs.put(RecoveringDeserializationExceptionHandler.KSTREAM_DESERIALIZATION_RECOVERER, Recoverer.class);
108108
handler.configure(configs);
109109
assertThat(KafkaTestUtils.getPropertyValue(handler, "recoverer")).isInstanceOf(Recoverer.class);
110-
assertThat(handler.handle((ProcessorContext) null, new ConsumerRecord<>("foo", 0, 0, null, null),
110+
assertThat(handler.handle((ErrorHandlerContext) null, new ConsumerRecord<>("foo", 0, 0, null, null),
111111
new IllegalArgumentException())).isEqualTo(DeserializationHandlerResponse.CONTINUE);
112-
assertThat(handler.handle((ProcessorContext) null, new ConsumerRecord<>("foo", 0, 0, null, null),
112+
assertThat(handler.handle((ErrorHandlerContext) null, new ConsumerRecord<>("foo", 0, 0, null, null),
113113
new IllegalStateException())).isEqualTo(DeserializationHandlerResponse.FAIL);
114114
}
115115

@@ -121,16 +121,16 @@ void viaObjectProperty() {
121121
configs.put(RecoveringDeserializationExceptionHandler.KSTREAM_DESERIALIZATION_RECOVERER, rec);
122122
handler.configure(configs);
123123
assertThat(KafkaTestUtils.getPropertyValue(handler, "recoverer")).isSameAs(rec);
124-
assertThat(handler.handle((ProcessorContext) null, new ConsumerRecord<>("foo", 0, 0, null, null),
124+
assertThat(handler.handle((ErrorHandlerContext) null, new ConsumerRecord<>("foo", 0, 0, null, null),
125125
new IllegalArgumentException())).isEqualTo(DeserializationHandlerResponse.CONTINUE);
126-
assertThat(handler.handle((ProcessorContext) null, new ConsumerRecord<>("foo", 0, 0, null, null),
126+
assertThat(handler.handle((ErrorHandlerContext) null, new ConsumerRecord<>("foo", 0, 0, null, null),
127127
new IllegalStateException())).isEqualTo(DeserializationHandlerResponse.FAIL);
128128
}
129129

130130
@Test
131131
void withNoRecoverer() {
132132
RecoveringDeserializationExceptionHandler handler = new RecoveringDeserializationExceptionHandler();
133-
assertThat(handler.handle((ProcessorContext) null, new ConsumerRecord<>("foo", 0, 0, null, null),
133+
assertThat(handler.handle((ErrorHandlerContext) null, new ConsumerRecord<>("foo", 0, 0, null, null),
134134
new IllegalArgumentException())).isEqualTo(DeserializationHandlerResponse.FAIL);
135135
}
136136

0 commit comments

Comments
 (0)