diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfiguration.java index 3880bed03e..967a87541d 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfiguration.java @@ -44,6 +44,7 @@ import org.springframework.boot.context.properties.PropertyMapper; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; +import org.springframework.core.io.ResourceLoader; /** * {@link EnableAutoConfiguration Auto-configuration} for {@link RabbitTemplate}. @@ -97,12 +98,11 @@ public class RabbitAutoConfiguration { @Bean public CachingConnectionFactory rabbitConnectionFactory(RabbitProperties properties, - ObjectProvider credentialsProvider, + ResourceLoader resourceLoader, ObjectProvider credentialsProvider, ObjectProvider credentialsRefreshService, ObjectProvider connectionNameStrategy) throws Exception { - CachingConnectionFactory factory = new CachingConnectionFactory( - getRabbitConnectionFactoryBean(properties, credentialsProvider, credentialsRefreshService) - .getObject()); + CachingConnectionFactory factory = new CachingConnectionFactory(getRabbitConnectionFactoryBean(properties, + resourceLoader, credentialsProvider, credentialsRefreshService).getObject()); PropertyMapper map = PropertyMapper.get(); map.from(properties::determineAddresses).to(factory::setAddresses); map.from(properties::getAddressShuffleMode).whenNonNull().to(factory::setAddressShuffleMode); @@ -120,9 +120,10 @@ public class RabbitAutoConfiguration { } private RabbitConnectionFactoryBean getRabbitConnectionFactoryBean(RabbitProperties properties, - ObjectProvider credentialsProvider, - ObjectProvider credentialsRefreshService) throws Exception { + ResourceLoader resourceLoader, ObjectProvider credentialsProvider, + ObjectProvider credentialsRefreshService) { RabbitConnectionFactoryBean factory = new RabbitConnectionFactoryBean(); + factory.setResourceLoader(resourceLoader); PropertyMapper map = PropertyMapper.get(); map.from(properties::determineHost).whenNonNull().to(factory::setHost); map.from(properties::determinePort).to(factory::setPort);