Skip to content

Commit

Permalink
Fix RecoveringDeserializationExceptionHandlerTests
Browse files Browse the repository at this point in the history
* 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`.
  • Loading branch information
sobychacko committed May 21, 2024
1 parent 457e94f commit 2db5e95
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2019-2022 the original author or authors.
* Copyright 2019-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -69,6 +69,7 @@

/**
* @author Gary Russell
* @author Soby Chacko
* @since 2.3
*
*/
Expand All @@ -78,7 +79,7 @@
public class RecoveringDeserializationExceptionHandlerTests {

@Autowired
private KafkaTemplate<byte[], byte[]> kafkaTemplate;
private KafkaOperations<byte[], byte[]> kafkaTemplate;

@Autowired
private CompletableFuture<ConsumerRecord<byte[], byte[]>> resultFuture;
Expand Down Expand Up @@ -177,7 +178,7 @@ public Map<String, Object> producerConfigs() {
}

@Bean
public KafkaOperations<byte[], byte[]> template() {
public KafkaTemplate<byte[], byte[]> template() {
KafkaTemplate<byte[], byte[]> kafkaTemplate = new KafkaTemplate<>(producerFactory(), true);
kafkaTemplate.setDefaultTopic("recoverer1");
return kafkaTemplate;
Expand Down

0 comments on commit 2db5e95

Please sign in to comment.