Browse Source

Merge branch '3.3.x'

Closes gh-43448
pull/43451/head
Phillip Webb 1 year ago
parent
commit
565ec07046
  1. 24
      spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/kafka/KafkaProperties.java
  2. 1
      spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/client/ClientsConfiguredCondition.java
  3. 6
      spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/kafka/KafkaPropertiesTests.java

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

@ -177,6 +177,18 @@ public class KafkaProperties { @@ -177,6 +177,18 @@ public class KafkaProperties {
return properties;
}
/**
* Create an initial map of consumer properties from the state of this instance.
* <p>
* This allows you to add additional properties, if necessary, and override the
* default {@code kafkaConsumerFactory} bean.
* @return the consumer properties initialized with the customizations defined on this
* instance
*/
public Map<String, Object> buildConsumerProperties() {
return buildConsumerProperties(null);
}
/**
* Create an initial map of consumer properties from the state of this instance.
* <p>
@ -192,6 +204,18 @@ public class KafkaProperties { @@ -192,6 +204,18 @@ public class KafkaProperties {
return properties;
}
/**
* Create an initial map of producer properties from the state of this instance.
* <p>
* This allows you to add additional properties, if necessary, and override the
* default {@code kafkaProducerFactory} bean.
* @return the producer properties initialized with the customizations defined on this
* instance
*/
public Map<String, Object> buildProducerProperties() {
return buildProducerProperties(null);
}
/**
* Create an initial map of producer properties from the state of this instance.
* <p>

1
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/client/ClientsConfiguredCondition.java

@ -36,7 +36,6 @@ import org.springframework.core.type.AnnotatedTypeMetadata; @@ -36,7 +36,6 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
* @author Madhura Bhave
* @since 2.1.0
*/
public class ClientsConfiguredCondition extends SpringBootCondition {
private static final Bindable<Map<String, OAuth2ClientProperties.Registration>> STRING_REGISTRATION_MAP = Bindable

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

@ -80,7 +80,7 @@ class KafkaPropertiesTests { @@ -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 { @@ -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 { @@ -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

Loading…
Cancel
Save