Skip to content

Commit 4c53755

Browse files
committed
Polish "Added keystore type and truststore type to rabbit properties"
Closes gh-10251
1 parent b70ac99 commit 4c53755

File tree

4 files changed

+11
-15
lines changed

4 files changed

+11
-15
lines changed

spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfiguration.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,10 @@ public CachingConnectionFactory rabbitConnectionFactory(RabbitProperties config)
113113
if (ssl.getAlgorithm() != null) {
114114
factory.setSslAlgorithm(ssl.getAlgorithm());
115115
}
116-
if (ssl.getKeyStoreType() != null) {
117-
factory.setKeyStoreType(ssl.getKeyStoreType());
118-
}
116+
factory.setKeyStoreType(ssl.getKeyStoreType());
119117
factory.setKeyStore(ssl.getKeyStore());
120118
factory.setKeyStorePassphrase(ssl.getKeyStorePassword());
121-
if (ssl.getTrustStoreType() != null) {
122-
factory.setTrustStoreType(ssl.getTrustStoreType());
123-
}
119+
factory.setTrustStoreType(ssl.getTrustStoreType());
124120
factory.setTrustStore(ssl.getTrustStore());
125121
factory.setTrustStorePassphrase(ssl.getTrustStorePassword());
126122
}

spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitProperties.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -315,9 +315,9 @@ public static class Ssl {
315315
private String keyStore;
316316

317317
/**
318-
* Set the key store type (jks, pkcs12, etc).
318+
* Key store type.
319319
*/
320-
private String keyStoreType;
320+
private String keyStoreType = "PKCS12";
321321

322322
/**
323323
* Password used to access the key store.
@@ -330,9 +330,9 @@ public static class Ssl {
330330
private String trustStore;
331331

332332
/**
333-
* Set the trust store type (jks, pkcs12, etc).
333+
* Trust store type.
334334
*/
335-
private String trustStoreType;
335+
private String trustStoreType = "JKS";
336336

337337
/**
338338
* Password used to access the trust store.

spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfigurationTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ public void enableSsl() {
542542

543543
@Test
544544
// Make sure that we at least attempt to load the store
545-
public void enableSslWithNonexistingKeystoreShouldFail() {
545+
public void enableSslWithNonExistingKeystoreShouldFail() {
546546
this.contextRunner
547547
.withUserConfiguration(TestConfiguration.class)
548548
.withPropertyValues("spring.rabbitmq.ssl.enabled:true",
@@ -557,7 +557,7 @@ public void enableSslWithNonexistingKeystoreShouldFail() {
557557

558558
@Test
559559
// Make sure that we at least attempt to load the store
560-
public void enableSslWithNonexistingTruststoreShouldFail() {
560+
public void enableSslWithNonExistingTrustStoreShouldFail() {
561561
this.contextRunner
562562
.withUserConfiguration(TestConfiguration.class)
563563
.withPropertyValues(
@@ -587,7 +587,7 @@ public void enableSslWithInvalidKeystoreTypeShouldFail() throws Exception {
587587
}
588588

589589
@Test
590-
public void enableSslWithInvalidTruststoreTypeShouldFail() throws Exception {
590+
public void enableSslWithInvalidTrustStoreTypeShouldFail() throws Exception {
591591
this.contextRunner
592592
.withUserConfiguration(TestConfiguration.class)
593593
.withPropertyValues(

spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,11 +1051,11 @@ content into your application; rather pick only the properties that you need.
10511051
spring.rabbitmq.requested-heartbeat= # Requested heartbeat timeout, in seconds; zero for none.
10521052
spring.rabbitmq.ssl.enabled=false # Enable SSL support.
10531053
spring.rabbitmq.ssl.key-store= # Path to the key store that holds the SSL certificate.
1054-
spring.rabbitmq.ssl.key-store-type= # Type of key store (jks, pkcs12,..). Defaults to pkcs12 if not set
10551054
spring.rabbitmq.ssl.key-store-password= # Password used to access the key store.
1055+
spring.rabbitmq.ssl.key-store-type=PKCS12 # Key store type.
10561056
spring.rabbitmq.ssl.trust-store= # Trust store that holds SSL certificates.
1057-
spring.rabbitmq.ssl.trust-store-type= # Type of trust store (jks, pkcs12,..). Defaults to jks if not set
10581057
spring.rabbitmq.ssl.trust-store-password= # Password used to access the trust store.
1058+
spring.rabbitmq.ssl.trust-store-type=JKS # Trust store type.
10591059
spring.rabbitmq.ssl.algorithm= # SSL algorithm to use. By default configure by the rabbit client library.
10601060
spring.rabbitmq.template.mandatory=false # Enable mandatory messages.
10611061
spring.rabbitmq.template.receive-timeout=0 # Timeout for `receive()` methods.

0 commit comments

Comments
 (0)