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
This commit is contained in:
Phillip Webb 2024-12-09 09:43:13 -08:00
parent f21402d4c3
commit 3338c22372
2 changed files with 3 additions and 9 deletions

View File

@ -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<String, Object> 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<String, Object> buildProducerProperties() {
return buildProducerProperties(null);
}

View File

@ -80,7 +80,7 @@ class KafkaPropertiesTests {
properties.getSsl().setKeyStoreKey("-----BEGINkey");
properties.getSsl().setTrustStoreCertificates("-----BEGINtrust");
properties.getSsl().setKeyStoreCertificateChain("-----BEGINchain");
Map<String, Object> consumerProperties = properties.buildConsumerProperties(null);
Map<String, Object> 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