Polish
This commit is contained in:
parent
07aeb2156d
commit
ea65c28bfa
|
|
@ -1186,14 +1186,7 @@ public class KafkaProperties {
|
|||
}
|
||||
|
||||
public Map<String, Object> buildProperties() {
|
||||
MutuallyExclusiveConfigurationPropertiesException.throwIfMultipleNonNullValuesIn((entries) -> {
|
||||
entries.put("spring.kafka.ssl.key-store-key", this.getKeyStoreKey());
|
||||
entries.put("spring.kafka.ssl.key-store-location", this.getKeyStoreLocation());
|
||||
});
|
||||
MutuallyExclusiveConfigurationPropertiesException.throwIfMultipleNonNullValuesIn((entries) -> {
|
||||
entries.put("spring.kafka.ssl.trust-store-certificates", this.getTrustStoreCertificates());
|
||||
entries.put("spring.kafka.ssl.trust-store-location", this.getTrustStoreLocation());
|
||||
});
|
||||
validate();
|
||||
Properties properties = new Properties();
|
||||
PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull();
|
||||
map.from(this::getKeyPassword).to(properties.in(SslConfigs.SSL_KEY_PASSWORD_CONFIG));
|
||||
|
|
@ -1213,6 +1206,17 @@ public class KafkaProperties {
|
|||
return properties;
|
||||
}
|
||||
|
||||
private void validate() {
|
||||
MutuallyExclusiveConfigurationPropertiesException.throwIfMultipleNonNullValuesIn((entries) -> {
|
||||
entries.put("spring.kafka.ssl.key-store-key", this.getKeyStoreKey());
|
||||
entries.put("spring.kafka.ssl.key-store-location", this.getKeyStoreLocation());
|
||||
});
|
||||
MutuallyExclusiveConfigurationPropertiesException.throwIfMultipleNonNullValuesIn((entries) -> {
|
||||
entries.put("spring.kafka.ssl.trust-store-certificates", this.getTrustStoreCertificates());
|
||||
entries.put("spring.kafka.ssl.trust-store-location", this.getTrustStoreLocation());
|
||||
});
|
||||
}
|
||||
|
||||
private String resourceToPath(Resource resource) {
|
||||
try {
|
||||
return resource.getFile().getAbsolutePath();
|
||||
|
|
|
|||
Loading…
Reference in New Issue