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 95113f0dbf95..fef1659dd270 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 @@ -187,21 +187,8 @@ private Map buildCommonProperties(SslBundles sslBundles) { * instance */ public Map buildConsumerProperties() { - return buildConsumerProperties(null); - } - - /** - * Create an initial map of consumer properties from the state of this instance. - *

- * This allows you to add additional properties, if necessary, and override the - * default {@code kafkaConsumerFactory} bean. - * @param sslBundles bundles providing SSL trust material - * @return the consumer properties initialized with the customizations defined on this - * instance - */ - public Map buildConsumerProperties(SslBundles sslBundles) { - Map properties = buildCommonProperties(sslBundles); - properties.putAll(this.consumer.buildProperties(sslBundles)); + Map properties = buildCommonProperties(null); + properties.putAll(this.consumer.buildProperties(null)); return properties; } 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 a536e0786e74..f68dfed82089 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 @@ -27,8 +27,6 @@ import org.springframework.boot.autoconfigure.kafka.KafkaProperties.IsolationLevel; import org.springframework.boot.autoconfigure.kafka.KafkaProperties.Listener; import org.springframework.boot.context.properties.source.MutuallyExclusiveConfigurationPropertiesException; -import org.springframework.boot.ssl.DefaultSslBundleRegistry; -import org.springframework.boot.ssl.SslBundle; import org.springframework.core.io.ClassPathResource; import org.springframework.kafka.core.CleanupConfig; import org.springframework.kafka.core.KafkaAdmin; @@ -36,7 +34,6 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; -import static org.mockito.Mockito.mock; /** * Tests for {@link KafkaProperties}. @@ -47,8 +44,6 @@ */ class KafkaPropertiesTests { - private final SslBundle sslBundle = mock(SslBundle.class); - @Test void isolationLevelEnumConsistentWithKafkaVersion() { org.apache.kafka.common.IsolationLevel[] original = org.apache.kafka.common.IsolationLevel.values(); @@ -101,15 +96,6 @@ void sslPemConfigurationWithEmptyBundle() { "-----BEGINchain"); } - @Test - void sslBundleConfiguration() { - KafkaProperties properties = new KafkaProperties(); - properties.getSsl().setBundle("myBundle"); - Map consumerProperties = properties - .buildConsumerProperties(new DefaultSslBundleRegistry("myBundle", this.sslBundle)); - assertThat(consumerProperties).doesNotContainKey(SslConfigs.SSL_ENGINE_FACTORY_CLASS_CONFIG); - } - @Test void sslPropertiesWhenKeyStoreLocationAndKeySetShouldThrowException() { KafkaProperties properties = new KafkaProperties(); @@ -128,42 +114,6 @@ void sslPropertiesWhenTrustStoreLocationAndCertificatesSetShouldThrowException() .isThrownBy(properties::buildConsumerProperties); } - @Test - void sslPropertiesWhenKeyStoreLocationAndBundleSetShouldThrowException() { - KafkaProperties properties = new KafkaProperties(); - properties.getSsl().setBundle("myBundle"); - properties.getSsl().setKeyStoreLocation(new ClassPathResource("ksLoc")); - assertThatExceptionOfType(MutuallyExclusiveConfigurationPropertiesException.class).isThrownBy( - () -> properties.buildConsumerProperties(new DefaultSslBundleRegistry("myBundle", this.sslBundle))); - } - - @Test - void sslPropertiesWhenKeyStoreKeyAndBundleSetShouldThrowException() { - KafkaProperties properties = new KafkaProperties(); - properties.getSsl().setBundle("myBundle"); - properties.getSsl().setKeyStoreKey("-----BEGIN"); - assertThatExceptionOfType(MutuallyExclusiveConfigurationPropertiesException.class).isThrownBy( - () -> properties.buildConsumerProperties(new DefaultSslBundleRegistry("myBundle", this.sslBundle))); - } - - @Test - void sslPropertiesWhenTrustStoreLocationAndBundleSetShouldThrowException() { - KafkaProperties properties = new KafkaProperties(); - properties.getSsl().setBundle("myBundle"); - properties.getSsl().setTrustStoreLocation(new ClassPathResource("tsLoc")); - assertThatExceptionOfType(MutuallyExclusiveConfigurationPropertiesException.class).isThrownBy( - () -> properties.buildConsumerProperties(new DefaultSslBundleRegistry("myBundle", this.sslBundle))); - } - - @Test - void sslPropertiesWhenTrustStoreCertificatesAndBundleSetShouldThrowException() { - KafkaProperties properties = new KafkaProperties(); - properties.getSsl().setBundle("myBundle"); - properties.getSsl().setTrustStoreCertificates("-----BEGIN"); - assertThatExceptionOfType(MutuallyExclusiveConfigurationPropertiesException.class).isThrownBy( - () -> properties.buildConsumerProperties(new DefaultSslBundleRegistry("myBundle", this.sslBundle))); - } - @Test void cleanupConfigDefaultValuesAreConsistent() { CleanupConfig cleanupConfig = new CleanupConfig();