Skip to content

Commit ea65c28

Browse files
committed
Polish
1 parent 07aeb21 commit ea65c28

File tree

1 file changed

+12
-8
lines changed
  • spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/kafka

1 file changed

+12
-8
lines changed

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

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1186,14 +1186,7 @@ public void setProtocol(String protocol) {
11861186
}
11871187

11881188
public Map<String, Object> buildProperties() {
1189-
MutuallyExclusiveConfigurationPropertiesException.throwIfMultipleNonNullValuesIn((entries) -> {
1190-
entries.put("spring.kafka.ssl.key-store-key", this.getKeyStoreKey());
1191-
entries.put("spring.kafka.ssl.key-store-location", this.getKeyStoreLocation());
1192-
});
1193-
MutuallyExclusiveConfigurationPropertiesException.throwIfMultipleNonNullValuesIn((entries) -> {
1194-
entries.put("spring.kafka.ssl.trust-store-certificates", this.getTrustStoreCertificates());
1195-
entries.put("spring.kafka.ssl.trust-store-location", this.getTrustStoreLocation());
1196-
});
1189+
validate();
11971190
Properties properties = new Properties();
11981191
PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull();
11991192
map.from(this::getKeyPassword).to(properties.in(SslConfigs.SSL_KEY_PASSWORD_CONFIG));
@@ -1213,6 +1206,17 @@ public Map<String, Object> buildProperties() {
12131206
return properties;
12141207
}
12151208

1209+
private void validate() {
1210+
MutuallyExclusiveConfigurationPropertiesException.throwIfMultipleNonNullValuesIn((entries) -> {
1211+
entries.put("spring.kafka.ssl.key-store-key", this.getKeyStoreKey());
1212+
entries.put("spring.kafka.ssl.key-store-location", this.getKeyStoreLocation());
1213+
});
1214+
MutuallyExclusiveConfigurationPropertiesException.throwIfMultipleNonNullValuesIn((entries) -> {
1215+
entries.put("spring.kafka.ssl.trust-store-certificates", this.getTrustStoreCertificates());
1216+
entries.put("spring.kafka.ssl.trust-store-location", this.getTrustStoreLocation());
1217+
});
1218+
}
1219+
12161220
private String resourceToPath(Resource resource) {
12171221
try {
12181222
return resource.getFile().getAbsolutePath();

0 commit comments

Comments
 (0)