From 1f66277fd683ab84e786c85edd57c09e92ef489c Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Fri, 5 Dec 2014 15:11:50 -0800 Subject: [PATCH] Fix JmsProperties bean not found exception Update JndiConnectionFactoryAutoConfiguration to ensure that the JmsProperties bean is created. Prior to this commit deployment to a WildFly would fail with a NoSuchBeanDefinitionException. Fixes gh-2072 --- .../jms/JndiConnectionFactoryAutoConfiguration.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/JndiConnectionFactoryAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/JndiConnectionFactoryAutoConfiguration.java index 5b519861b0..4b91d91ae2 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/JndiConnectionFactoryAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/JndiConnectionFactoryAutoConfiguration.java @@ -25,13 +25,16 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.AutoConfigureBefore; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.condition.AnyNestedCondition; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnJndi; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.autoconfigure.jms.JndiConnectionFactoryAutoConfiguration.JndiOrPropertyCondition; +import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Configuration; +import org.springframework.jms.core.JmsTemplate; import org.springframework.jndi.JndiLocatorDelegate; import org.springframework.util.StringUtils; @@ -43,8 +46,10 @@ import org.springframework.util.StringUtils; */ @Configuration @AutoConfigureBefore(JmsAutoConfiguration.class) +@ConditionalOnClass(JmsTemplate.class) @ConditionalOnMissingBean(ConnectionFactory.class) @Conditional(JndiOrPropertyCondition.class) +@EnableConfigurationProperties(JmsProperties.class) public class JndiConnectionFactoryAutoConfiguration { // Keep these in sync with the condition below