From 3338c22372e8558e3d04e9be7a2321673e6aef5d Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Mon, 9 Dec 2024 09:43:13 -0800 Subject: [PATCH] Restore `build...` methods that don't need an SSL bundle Restore `buildConsumerProperties()` and `buildProducerProperties()` methods in `KafkaProperties` to make it more convenient to use them without an SSL bundle. Fixes gh-43300 --- .../boot/autoconfigure/kafka/KafkaProperties.java | 6 ------ .../boot/autoconfigure/kafka/KafkaPropertiesTests.java | 6 +++--- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/kafka/KafkaProperties.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/kafka/KafkaProperties.java index c74fa291f73..5ee77cd66ed 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/kafka/KafkaProperties.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/kafka/KafkaProperties.java @@ -183,10 +183,7 @@ public class KafkaProperties { * default {@code kafkaConsumerFactory} bean. * @return the consumer properties initialized with the customizations defined on this * instance - * @deprecated since 3.2.0 for removal in 3.4.0 in favor of - * {@link #buildConsumerProperties(SslBundles)}} */ - @Deprecated(since = "3.2.0", forRemoval = true) public Map buildConsumerProperties() { return buildConsumerProperties(null); } @@ -213,10 +210,7 @@ public class KafkaProperties { * default {@code kafkaProducerFactory} bean. * @return the producer properties initialized with the customizations defined on this * instance - * @deprecated since 3.2.0 for removal in 3.4.0 in favor of - * {@link #buildProducerProperties(SslBundles)}} */ - @Deprecated(since = "3.2.0", forRemoval = true) public Map buildProducerProperties() { return buildProducerProperties(null); } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/kafka/KafkaPropertiesTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/kafka/KafkaPropertiesTests.java index dbd53fd59d8..f00ddd930be 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/kafka/KafkaPropertiesTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/kafka/KafkaPropertiesTests.java @@ -80,7 +80,7 @@ class KafkaPropertiesTests { properties.getSsl().setKeyStoreKey("-----BEGINkey"); properties.getSsl().setTrustStoreCertificates("-----BEGINtrust"); properties.getSsl().setKeyStoreCertificateChain("-----BEGINchain"); - Map consumerProperties = properties.buildConsumerProperties(null); + Map consumerProperties = properties.buildConsumerProperties(); assertThat(consumerProperties).containsEntry(SslConfigs.SSL_KEYSTORE_KEY_CONFIG, "-----BEGINkey"); assertThat(consumerProperties).containsEntry(SslConfigs.SSL_TRUSTSTORE_CERTIFICATES_CONFIG, "-----BEGINtrust"); assertThat(consumerProperties).containsEntry(SslConfigs.SSL_KEYSTORE_CERTIFICATE_CHAIN_CONFIG, @@ -103,7 +103,7 @@ class KafkaPropertiesTests { properties.getSsl().setKeyStoreKey("-----BEGIN"); properties.getSsl().setKeyStoreLocation(new ClassPathResource("ksLoc")); assertThatExceptionOfType(MutuallyExclusiveConfigurationPropertiesException.class) - .isThrownBy(() -> properties.buildConsumerProperties(null)); + .isThrownBy(() -> properties.buildConsumerProperties()); } @Test @@ -112,7 +112,7 @@ class KafkaPropertiesTests { properties.getSsl().setTrustStoreLocation(new ClassPathResource("tsLoc")); properties.getSsl().setTrustStoreCertificates("-----BEGIN"); assertThatExceptionOfType(MutuallyExclusiveConfigurationPropertiesException.class) - .isThrownBy(() -> properties.buildConsumerProperties(null)); + .isThrownBy(() -> properties.buildConsumerProperties()); } @Test