diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfiguration.java index 6fc51731e07..1ba8aaf1a93 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfiguration.java @@ -16,9 +16,6 @@ package org.springframework.boot.autoconfigure.amqp; -import java.io.ByteArrayOutputStream; -import java.util.Properties; - import org.springframework.amqp.core.AmqpAdmin; import org.springframework.amqp.rabbit.connection.CachingConnectionFactory; import org.springframework.amqp.rabbit.connection.ConnectionFactory; @@ -35,7 +32,6 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; -import org.springframework.core.io.ByteArrayResource; import com.rabbitmq.client.Channel; @@ -128,13 +124,10 @@ public class RabbitAutoConfiguration { RabbitProperties.Ssl ssl = config.getSsl(); if (ssl.isEnabled()) { factory.setUseSSL(true); - if (ssl.getKeyStore() != null || ssl.getTrustStore() != null) { - Properties properties = ssl.createSslProperties(); - ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); - properties.store(outputStream, "SSL config"); - factory.setSslPropertiesLocation(new ByteArrayResource(outputStream - .toByteArray())); - } + factory.setKeyStore(ssl.getKeyStore()); + factory.setKeyStorePassphrase(ssl.getKeyStorePassword()); + factory.setTrustStore(ssl.getTrustStore()); + factory.setTrustStorePassphrase(ssl.getTrustStorePassword()); } factory.afterPropertiesSet(); CachingConnectionFactory connectionFactory = new CachingConnectionFactory( diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitProperties.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitProperties.java index 06b8d587085..170ee294491 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitProperties.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitProperties.java @@ -17,7 +17,6 @@ package org.springframework.boot.autoconfigure.amqp; import java.util.LinkedHashSet; -import java.util.Properties; import java.util.Set; import org.springframework.amqp.core.AcknowledgeMode; @@ -258,29 +257,6 @@ public class RabbitProperties { this.trustStorePassword = trustStorePassword; } - /** - * Create the ssl configuration as expected by the - * {@link org.springframework.amqp.rabbit.connection.RabbitConnectionFactoryBean - * RabbitConnectionFactoryBean}. - * @return the ssl configuration - */ - public Properties createSslProperties() { - Properties properties = new Properties(); - if (getKeyStore() != null) { - properties.put("keyStore", getKeyStore()); - } - if (getKeyStorePassword() != null) { - properties.put("keyStore.passPhrase", getKeyStorePassword()); - } - if (getTrustStore() != null) { - properties.put("trustStore", getTrustStore()); - } - if (getTrustStorePassword() != null) { - properties.put("trustStore.passPhrase", getTrustStorePassword()); - } - return properties; - } - } public static class Listener {