Skip to content

Commit 2db5e95

Browse files
committed
Fix RecoveringDeserializationExceptionHandlerTests
* In Spring Framework 6.2.x, it is no longer possible to inject by the target type if the bean definition uses an interface as its return type. Fix this situation in `RecoveringDeserializationExceptionHandlerTests`, where it was defining the bean type as `KafkaOperations`, but injecting as `KafkaTemplate`. This fix makes the bean definition return `KafkaTemplate` (the target type) and then the injection can use either `KafkaOperations` or `KafkaTemplate`.
1 parent 457e94f commit 2db5e95

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2022 the original author or authors.
2+
* Copyright 2019-2024 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.
@@ -69,6 +69,7 @@
6969

7070
/**
7171
* @author Gary Russell
72+
* @author Soby Chacko
7273
* @since 2.3
7374
*
7475
*/
@@ -78,7 +79,7 @@
7879
public class RecoveringDeserializationExceptionHandlerTests {
7980

8081
@Autowired
81-
private KafkaTemplate<byte[], byte[]> kafkaTemplate;
82+
private KafkaOperations<byte[], byte[]> kafkaTemplate;
8283

8384
@Autowired
8485
private CompletableFuture<ConsumerRecord<byte[], byte[]>> resultFuture;
@@ -177,7 +178,7 @@ public Map<String, Object> producerConfigs() {
177178
}
178179

179180
@Bean
180-
public KafkaOperations<byte[], byte[]> template() {
181+
public KafkaTemplate<byte[], byte[]> template() {
181182
KafkaTemplate<byte[], byte[]> kafkaTemplate = new KafkaTemplate<>(producerFactory(), true);
182183
kafkaTemplate.setDefaultTopic("recoverer1");
183184
return kafkaTemplate;

0 commit comments

Comments
 (0)