From c8b7a17545925aa69352cc047956c5c7c3468e57 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Mon, 14 Feb 2022 08:22:13 +0100 Subject: [PATCH] Upgrade to Spring Kafka 2.8.3 Closes gh-29722 --- .../ConcurrentKafkaListenerContainerFactoryConfigurer.java | 3 ++- .../boot/autoconfigure/kafka/KafkaAutoConfigurationTests.java | 2 ++ spring-boot-project/spring-boot-dependencies/build.gradle | 2 +- .../spring-boot-docs/src/docs/asciidoc/messaging/kafka.adoc | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/kafka/ConcurrentKafkaListenerContainerFactoryConfigurer.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/kafka/ConcurrentKafkaListenerContainerFactoryConfigurer.java index d6472ee012..c456798475 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/kafka/ConcurrentKafkaListenerContainerFactoryConfigurer.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/kafka/ConcurrentKafkaListenerContainerFactoryConfigurer.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2021 the original author or authors. + * Copyright 2012-2022 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. @@ -169,6 +169,7 @@ public class ConcurrentKafkaListenerContainerFactoryConfigurer { configureContainer(listenerFactory.getContainerProperties()); } + @SuppressWarnings("deprecation") private void configureListenerFactory(ConcurrentKafkaListenerContainerFactory factory) { PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull(); Listener properties = this.properties.getListener(); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/kafka/KafkaAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/kafka/KafkaAutoConfigurationTests.java index e4091b1d9e..08790d0c8b 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/kafka/KafkaAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/kafka/KafkaAutoConfigurationTests.java @@ -508,6 +508,7 @@ class KafkaAutoConfigurationTests { } @Test + @Deprecated void testConcurrentKafkaListenerContainerFactoryWithCustomErrorHandler() { this.contextRunner.withBean("errorHandler", ErrorHandler.class, () -> mock(ErrorHandler.class)) .run((context) -> { @@ -518,6 +519,7 @@ class KafkaAutoConfigurationTests { } @Test + @Deprecated void concurrentKafkaListenerContainerFactoryInBatchModeShouldUseBatchErrorHandler() { this.contextRunner.withBean("batchErrorHandler", BatchErrorHandler.class, () -> mock(BatchErrorHandler.class)) .withPropertyValues("spring.kafka.listener.type=batch").run((context) -> { diff --git a/spring-boot-project/spring-boot-dependencies/build.gradle b/spring-boot-project/spring-boot-dependencies/build.gradle index 9db059a9e5..6e162de2a3 100644 --- a/spring-boot-project/spring-boot-dependencies/build.gradle +++ b/spring-boot-project/spring-boot-dependencies/build.gradle @@ -1673,7 +1673,7 @@ bom { ] } } - library("Spring Kafka", "2.8.2") { + library("Spring Kafka", "2.8.3") { group("org.springframework.kafka") { modules = [ "spring-kafka", diff --git a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/messaging/kafka.adoc b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/messaging/kafka.adoc index b01dfc1c49..ab6704f477 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/messaging/kafka.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/messaging/kafka.adoc @@ -48,7 +48,7 @@ include::{docs-java}/messaging/kafka/receiving/MyBean.java[] ---- If a `KafkaTransactionManager` bean is defined, it is automatically associated to the container factory. -Similarly, if a `RecordFilterStrategy`, `ErrorHandler`, `CommonErrorHandler`, `AfterRollbackProcessor` or `ConsumerAwareRebalanceListener` bean is defined, it is automatically associated to the default factory. +Similarly, if a `RecordFilterStrategy`, `CommonErrorHandler`, `AfterRollbackProcessor` or `ConsumerAwareRebalanceListener` bean is defined, it is automatically associated to the default factory. Depending on the listener type, a `RecordMessageConverter` or `BatchMessageConverter` bean is associated to the default factory. If only a `RecordMessageConverter` bean is present for a batch listener, it is wrapped in a `BatchMessageConverter`.