Skip to content

Commit 3338c22

Browse files
committed
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
1 parent f21402d commit 3338c22

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/kafka/KafkaProperties.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -183,10 +183,7 @@ private Map<String, Object> buildCommonProperties(SslBundles sslBundles) {
183183
* default {@code kafkaConsumerFactory} bean.
184184
* @return the consumer properties initialized with the customizations defined on this
185185
* instance
186-
* @deprecated since 3.2.0 for removal in 3.4.0 in favor of
187-
* {@link #buildConsumerProperties(SslBundles)}}
188186
*/
189-
@Deprecated(since = "3.2.0", forRemoval = true)
190187
public Map<String, Object> buildConsumerProperties() {
191188
return buildConsumerProperties(null);
192189
}
@@ -213,10 +210,7 @@ public Map<String, Object> buildConsumerProperties(SslBundles sslBundles) {
213210
* default {@code kafkaProducerFactory} bean.
214211
* @return the producer properties initialized with the customizations defined on this
215212
* instance
216-
* @deprecated since 3.2.0 for removal in 3.4.0 in favor of
217-
* {@link #buildProducerProperties(SslBundles)}}
218213
*/
219-
@Deprecated(since = "3.2.0", forRemoval = true)
220214
public Map<String, Object> buildProducerProperties() {
221215
return buildProducerProperties(null);
222216
}

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/kafka/KafkaPropertiesTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ void sslPemConfiguration() {
8080
properties.getSsl().setKeyStoreKey("-----BEGINkey");
8181
properties.getSsl().setTrustStoreCertificates("-----BEGINtrust");
8282
properties.getSsl().setKeyStoreCertificateChain("-----BEGINchain");
83-
Map<String, Object> consumerProperties = properties.buildConsumerProperties(null);
83+
Map<String, Object> consumerProperties = properties.buildConsumerProperties();
8484
assertThat(consumerProperties).containsEntry(SslConfigs.SSL_KEYSTORE_KEY_CONFIG, "-----BEGINkey");
8585
assertThat(consumerProperties).containsEntry(SslConfigs.SSL_TRUSTSTORE_CERTIFICATES_CONFIG, "-----BEGINtrust");
8686
assertThat(consumerProperties).containsEntry(SslConfigs.SSL_KEYSTORE_CERTIFICATE_CHAIN_CONFIG,
@@ -103,7 +103,7 @@ void sslPropertiesWhenKeyStoreLocationAndKeySetShouldThrowException() {
103103
properties.getSsl().setKeyStoreKey("-----BEGIN");
104104
properties.getSsl().setKeyStoreLocation(new ClassPathResource("ksLoc"));
105105
assertThatExceptionOfType(MutuallyExclusiveConfigurationPropertiesException.class)
106-
.isThrownBy(() -> properties.buildConsumerProperties(null));
106+
.isThrownBy(() -> properties.buildConsumerProperties());
107107
}
108108

109109
@Test
@@ -112,7 +112,7 @@ void sslPropertiesWhenTrustStoreLocationAndCertificatesSetShouldThrowException()
112112
properties.getSsl().setTrustStoreLocation(new ClassPathResource("tsLoc"));
113113
properties.getSsl().setTrustStoreCertificates("-----BEGIN");
114114
assertThatExceptionOfType(MutuallyExclusiveConfigurationPropertiesException.class)
115-
.isThrownBy(() -> properties.buildConsumerProperties(null));
115+
.isThrownBy(() -> properties.buildConsumerProperties());
116116
}
117117

118118
@Test

0 commit comments

Comments
 (0)