Validates that the classpath contain the necessary classes before + * starting an embedded broker. + * + * @author Stephane Nicoll + */ +@Configuration +@AutoConfigureBefore(JmsTemplateAutoConfiguration.class) +@ConditionalOnClass({ConnectionFactory.class, ActiveMQConnectionFactory.class}) +@ConditionalOnMissingBean(ConnectionFactory.class) +public class ActiveMQAutoConfiguration { + + @Configuration + @ConditionalOnClass(VMTransportFactory.class) + @Conditional(EmbeddedBrokerCondition.class) + @Import(ActiveMQConnectionFactoryConfiguration.class) + protected static class EmbeddedBroker { + } + + @Configuration + @Conditional(NonEmbeddedBrokerCondition.class) + @Import(ActiveMQConnectionFactoryConfiguration.class) + protected static class NetworkBroker { + } + + static abstract class BrokerTypeCondition extends SpringBootCondition { + private final boolean embedded; + + BrokerTypeCondition(boolean embedded) { + this.embedded = embedded; + } + + @Override + public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { + String brokerUrl = ActiveMQProperties.determineBrokerUrl(context.getEnvironment()); + boolean match = brokerUrl.contains("vm://"); + boolean outcome = (match == this.embedded); + return new ConditionOutcome(outcome, buildMessage(brokerUrl, outcome)); + } + + protected String buildMessage(String brokerUrl, boolean outcome) { + String brokerType = embedded ? "Embedded" : "Network"; + String detected = outcome ? "detected" : "not detected"; + return brokerType + " ActiveMQ broker " + detected + " - brokerUrl '" + brokerUrl + "'"; + } + } + + static class EmbeddedBrokerCondition extends BrokerTypeCondition { + + EmbeddedBrokerCondition() { + super(true); + } + } + + static class NonEmbeddedBrokerCondition extends BrokerTypeCondition { + + NonEmbeddedBrokerCondition() { + super(false); + } + } + +} diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/ActiveMQConnectionFactoryConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/ActiveMQConnectionFactoryConfiguration.java new file mode 100644 index 0000000000..aeb58ac67f --- /dev/null +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/ActiveMQConnectionFactoryConfiguration.java @@ -0,0 +1,62 @@ +/* + * Copyright 2012-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.boot.autoconfigure.jms; + +import javax.jms.ConnectionFactory; + +import org.apache.activemq.ActiveMQConnectionFactory; +import org.apache.activemq.pool.PooledConnectionFactory; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.util.StringUtils; + +/** + * Creates a {@link ConnectionFactory} based on {@link ActiveMQProperties}. + * + * @author Greg Turnquist + * @author Stephane Nicoll + */ +@Configuration +@EnableConfigurationProperties(ActiveMQProperties.class) +class ActiveMQConnectionFactoryConfiguration { + + @Autowired + private ActiveMQProperties config; + + @Bean + public ConnectionFactory jmsConnectionFactory() { + ConnectionFactory connectionFactory = getActiveMQConnectionFactory(); + if (this.config.isPooled()) { + PooledConnectionFactory pool = new PooledConnectionFactory(); + pool.setConnectionFactory(connectionFactory); + return pool; + } + return connectionFactory; + } + + private ConnectionFactory getActiveMQConnectionFactory() { + if (StringUtils.hasLength(this.config.getUser()) + && StringUtils.hasLength(this.config.getPassword())) { + return new ActiveMQConnectionFactory(this.config.getUser(), + this.config.getPassword(), this.config.getBrokerUrl()); + } + return new ActiveMQConnectionFactory(this.config.getBrokerUrl()); + } +} diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/ActiveMQProperties.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/ActiveMQProperties.java index cb963fdefd..b90fe3e946 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/ActiveMQProperties.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/ActiveMQProperties.java @@ -16,17 +16,25 @@ package org.springframework.boot.autoconfigure.jms; +import org.springframework.boot.bind.RelaxedPropertyResolver; import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.core.env.Environment; +import org.springframework.core.env.PropertyResolver; /** * Configuration properties for ActiveMQ * * @author Greg Turnquist + * @author Stephane Nicoll */ @ConfigurationProperties(prefix = "spring.activemq") public class ActiveMQProperties { - private String brokerUrl = "tcp://localhost:61616"; + public static final String DEFAULT_EMBEDDED_BROKER_URL = "vm://localhost?broker.persistent=false"; + + public static final String DEFAULT_NETWORK_BROKER_URL = "tcp://localhost:61616"; + + private String brokerUrl = null; private boolean inMemory = true; @@ -36,18 +44,35 @@ public class ActiveMQProperties { private String password; - // Will override brokerURL if inMemory is set to true + /** + * Determine the broker url to use for the specified {@link Environment}. + *
If no broker url is specified through configuration, a default
+ * broker is provided, that is {@value #DEFAULT_EMBEDDED_BROKER_URL} if
+ * the {@code inMemory} flag is {@code null} or {@code true},
+ * {@value #DEFAULT_NETWORK_BROKER_URL} otherwise.
+ *
+ * @param environment the environment to extract configuration from
+ * @return the broker url to use
+ */
+ public static String determineBrokerUrl(Environment environment) {
+ PropertyResolver resolver = new RelaxedPropertyResolver(environment, "spring.activemq.");
+ String brokerUrl = resolver.getProperty("brokerUrl");
+ Boolean inMemory = resolver.getProperty("inMemory", Boolean.class);
+ return determineBrokerUrl(brokerUrl, inMemory);
+ }
+
public String getBrokerUrl() {
- if (this.inMemory) {
- return "vm://localhost";
- }
- return this.brokerUrl;
+ return determineBrokerUrl(this.brokerUrl, this.inMemory);
}
public void setBrokerUrl(String brokerUrl) {
this.brokerUrl = brokerUrl;
}
+ /**
+ * Specify if the default broker url should be in memory. Ignored
+ * if an explicit broker has been specified.
+ */
public boolean isInMemory() {
return this.inMemory;
}
@@ -80,4 +105,22 @@ public class ActiveMQProperties {
this.password = password;
}
+
+ /**
+ * @see #determineBrokerUrl(Environment)
+ */
+ private static String determineBrokerUrl(String brokerUrl, Boolean inMemory) {
+ boolean embedded = (inMemory != null) ? inMemory : true;
+
+ if (brokerUrl != null) {
+ return brokerUrl;
+ }
+ else if (embedded) {
+ return DEFAULT_EMBEDDED_BROKER_URL;
+ }
+ else {
+ return DEFAULT_NETWORK_BROKER_URL;
+ }
+ }
+
}
diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/JmsTemplateAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/JmsTemplateAutoConfiguration.java
index 3dfaca207e..e2e90c255a 100644
--- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/JmsTemplateAutoConfiguration.java
+++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/JmsTemplateAutoConfiguration.java
@@ -18,25 +18,24 @@ package org.springframework.boot.autoconfigure.jms;
import javax.jms.ConnectionFactory;
-import org.apache.activemq.ActiveMQConnectionFactory;
-import org.apache.activemq.pool.PooledConnectionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.jms.core.JmsTemplate;
-import org.springframework.util.StringUtils;
/**
* {@link EnableAutoConfiguration Auto-configuration} for {@link JmsTemplate}.
- *
+ *
* @author Greg Turnquist
*/
@Configuration
-@ConditionalOnClass({ JmsTemplate.class, ConnectionFactory.class })
+@ConditionalOnClass(JmsTemplate.class)
+@ConditionalOnBean(ConnectionFactory.class)
@EnableConfigurationProperties(JmsTemplateProperties.class)
public class JmsTemplateAutoConfiguration {
@@ -54,34 +53,4 @@ public class JmsTemplateAutoConfiguration {
return jmsTemplate;
}
- @Configuration
- @ConditionalOnClass(ActiveMQConnectionFactory.class)
- @ConditionalOnMissingBean(ConnectionFactory.class)
- @EnableConfigurationProperties(ActiveMQProperties.class)
- protected static class ActiveMQConnectionFactoryCreator {
-
- @Autowired
- private ActiveMQProperties config;
-
- @Bean
- public ConnectionFactory jmsConnectionFactory() {
- ConnectionFactory connectionFactory = getActiveMQConnectionFactory();
- if (this.config.isPooled()) {
- PooledConnectionFactory pool = new PooledConnectionFactory();
- pool.setConnectionFactory(connectionFactory);
- return pool;
- }
- return connectionFactory;
- }
-
- private ConnectionFactory getActiveMQConnectionFactory() {
- if (StringUtils.hasLength(this.config.getUser())
- && StringUtils.hasLength(this.config.getPassword())) {
- return new ActiveMQConnectionFactory(this.config.getUser(),
- this.config.getPassword(), this.config.getBrokerUrl());
- }
- return new ActiveMQConnectionFactory(this.config.getBrokerUrl());
- }
- }
-
}
diff --git a/spring-boot-autoconfigure/src/main/resources/META-INF/spring.factories b/spring-boot-autoconfigure/src/main/resources/META-INF/spring.factories
index 5db10f70e5..a0bb7581a9 100644
--- a/spring-boot-autoconfigure/src/main/resources/META-INF/spring.factories
+++ b/spring-boot-autoconfigure/src/main/resources/META-INF/spring.factories
@@ -17,6 +17,7 @@ org.springframework.boot.autoconfigure.hateoas.HypermediaAutoConfiguration,\
org.springframework.boot.autoconfigure.integration.IntegrationAutoConfiguration,\
org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,\
org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration,\
+org.springframework.boot.autoconfigure.jms.ActiveMQAutoConfiguration,\
org.springframework.boot.autoconfigure.jms.JmsTemplateAutoConfiguration,\
org.springframework.boot.autoconfigure.jmx.JmxAutoConfiguration,\
org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration,\
diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/ActiveMQPropertiesTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/ActiveMQPropertiesTests.java
new file mode 100644
index 0000000000..26f02c2dc8
--- /dev/null
+++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/ActiveMQPropertiesTests.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2012-2014 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.boot.autoconfigure.jms;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+import org.springframework.boot.test.EnvironmentTestUtils;
+import org.springframework.core.env.StandardEnvironment;
+
+/**
+ *
+ * @author Stephane Nicoll
+ */
+public class ActiveMQPropertiesTests {
+
+ private final ActiveMQProperties properties = new ActiveMQProperties();
+ private final StandardEnvironment environment = new StandardEnvironment();
+
+ @Test
+ public void determineBrokerUrlDefault() {
+ assertEquals(ActiveMQProperties.DEFAULT_EMBEDDED_BROKER_URL,
+ ActiveMQProperties.determineBrokerUrl(this.environment));
+ }
+
+ @Test
+ public void determineBrokerUrlVmBrokerUrl() {
+ EnvironmentTestUtils.addEnvironment(this.environment,
+ "spring.activemq.brokerUrl:vm://localhost?persistent=true");
+ assertEquals("vm://localhost?persistent=true",
+ ActiveMQProperties.determineBrokerUrl(this.environment));
+ }
+
+ @Test
+ public void determineBrokerUrlInMemoryFlag() {
+ EnvironmentTestUtils.addEnvironment(this.environment,
+ "spring.activemq.inMemory:false");
+ assertEquals(ActiveMQProperties.DEFAULT_NETWORK_BROKER_URL,
+ ActiveMQProperties.determineBrokerUrl(this.environment));
+ }
+
+ @Test
+ public void getBrokerUrlIsInMemoryByDefault() {
+ assertEquals(ActiveMQProperties.DEFAULT_EMBEDDED_BROKER_URL, this.properties.getBrokerUrl());
+ }
+
+ @Test
+ public void getBrokerUrlUseExplicitBrokerUrl() {
+ this.properties.setBrokerUrl("vm://foo-bar");
+ assertEquals("vm://foo-bar", this.properties.getBrokerUrl());
+ }
+
+ @Test
+ public void getBrokerUrlWithInMemorySetToFalse() {
+ this.properties.setInMemory(false);
+ assertEquals(ActiveMQProperties.DEFAULT_NETWORK_BROKER_URL, this.properties.getBrokerUrl());
+ }
+
+ @Test
+ public void getExplicitBrokerUrlAlwaysWins() {
+ this.properties.setBrokerUrl("vm://foo-bar");
+ this.properties.setInMemory(false);
+ assertEquals("vm://foo-bar", this.properties.getBrokerUrl());
+ }
+}
diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/JmsTemplateAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/JmsTemplateAutoConfigurationTests.java
index 309feca26d..55ff6111ef 100644
--- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/JmsTemplateAutoConfigurationTests.java
+++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/JmsTemplateAutoConfigurationTests.java
@@ -45,9 +45,7 @@ public class JmsTemplateAutoConfigurationTests {
@Test
public void testDefaultJmsTemplate() {
- this.context = new AnnotationConfigApplicationContext();
- this.context
- .register(TestConfiguration.class, JmsTemplateAutoConfiguration.class);
+ this.context = createContext(TestConfiguration.class);
this.context.refresh();
JmsTemplate jmsTemplate = this.context.getBean(JmsTemplate.class);
ActiveMQConnectionFactory connectionFactory = this.context
@@ -55,14 +53,13 @@ public class JmsTemplateAutoConfigurationTests {
assertNotNull(jmsTemplate);
assertNotNull(connectionFactory);
assertEquals(jmsTemplate.getConnectionFactory(), connectionFactory);
- assertEquals("vm://localhost", ((ActiveMQConnectionFactory) jmsTemplate.getConnectionFactory()).getBrokerURL());
+ assertEquals(ActiveMQProperties.DEFAULT_EMBEDDED_BROKER_URL,
+ ((ActiveMQConnectionFactory) jmsTemplate.getConnectionFactory()).getBrokerURL());
}
@Test
public void testConnectionFactoryBackoff() {
- this.context = new AnnotationConfigApplicationContext();
- this.context.register(TestConfiguration2.class,
- JmsTemplateAutoConfiguration.class);
+ this.context = createContext(TestConfiguration2.class);
this.context.refresh();
assertEquals("foobar", this.context.getBean(ActiveMQConnectionFactory.class)
.getBrokerURL());
@@ -70,9 +67,7 @@ public class JmsTemplateAutoConfigurationTests {
@Test
public void testJmsTemplateBackoff() {
- this.context = new AnnotationConfigApplicationContext();
- this.context.register(TestConfiguration3.class,
- JmsTemplateAutoConfiguration.class);
+ this.context = createContext(TestConfiguration3.class);
this.context.refresh();
JmsTemplate jmsTemplate = this.context.getBean(JmsTemplate.class);
assertEquals(999, jmsTemplate.getPriority());
@@ -80,9 +75,7 @@ public class JmsTemplateAutoConfigurationTests {
@Test
public void testJmsTemplateBackoffEverything() {
- this.context = new AnnotationConfigApplicationContext();
- this.context.register(TestConfiguration2.class, TestConfiguration3.class,
- JmsTemplateAutoConfiguration.class);
+ this.context = createContext(TestConfiguration2.class, TestConfiguration3.class);
this.context.refresh();
JmsTemplate jmsTemplate = this.context.getBean(JmsTemplate.class);
assertEquals(999, jmsTemplate.getPriority());
@@ -92,9 +85,7 @@ public class JmsTemplateAutoConfigurationTests {
@Test
public void testPubSubDisabledByDefault() {
- this.context = new AnnotationConfigApplicationContext();
- this.context
- .register(TestConfiguration.class, JmsTemplateAutoConfiguration.class);
+ this.context = createContext(TestConfiguration.class);
this.context.refresh();
JmsTemplate jmsTemplate = this.context.getBean(JmsTemplate.class);
assertFalse(jmsTemplate.isPubSubDomain());
@@ -102,9 +93,7 @@ public class JmsTemplateAutoConfigurationTests {
@Test
public void testJmsTemplatePostProcessedSoThatPubSubIsTrue() {
- this.context = new AnnotationConfigApplicationContext();
- this.context.register(TestConfiguration4.class,
- JmsTemplateAutoConfiguration.class);
+ this.context = createContext(TestConfiguration4.class);
this.context.refresh();
JmsTemplate jmsTemplate = this.context.getBean(JmsTemplate.class);
assertTrue(jmsTemplate.isPubSubDomain());
@@ -112,9 +101,7 @@ public class JmsTemplateAutoConfigurationTests {
@Test
public void testJmsTemplateOverridden() {
- this.context = new AnnotationConfigApplicationContext();
- this.context
- .register(TestConfiguration.class, JmsTemplateAutoConfiguration.class);
+ this.context = createContext(TestConfiguration.class);
EnvironmentTestUtils
.addEnvironment(this.context, "spring.jms.pubSubDomain:false");
this.context.refresh();
@@ -129,9 +116,7 @@ public class JmsTemplateAutoConfigurationTests {
@Test
public void testActiveMQOverriddenStandalone() {
- this.context = new AnnotationConfigApplicationContext();
- this.context
- .register(TestConfiguration.class, JmsTemplateAutoConfiguration.class);
+ this.context = createContext(TestConfiguration.class);
EnvironmentTestUtils.addEnvironment(this.context,
"spring.activemq.inMemory:false");
this.context.refresh();
@@ -141,17 +126,14 @@ public class JmsTemplateAutoConfigurationTests {
assertNotNull(jmsTemplate);
assertNotNull(connectionFactory);
assertEquals(jmsTemplate.getConnectionFactory(), connectionFactory);
- assertEquals("tcp://localhost:61616",
+ assertEquals(ActiveMQProperties.DEFAULT_NETWORK_BROKER_URL,
((ActiveMQConnectionFactory) jmsTemplate.getConnectionFactory()).getBrokerURL());
}
@Test
public void testActiveMQOverriddenRemoteHost() {
- this.context = new AnnotationConfigApplicationContext();
- this.context
- .register(TestConfiguration.class, JmsTemplateAutoConfiguration.class);
+ this.context = createContext(TestConfiguration.class);
EnvironmentTestUtils.addEnvironment(this.context,
- "spring.activemq.inMemory:false",
"spring.activemq.brokerUrl:tcp://remote-host:10000");
this.context.refresh();
JmsTemplate jmsTemplate = this.context.getBean(JmsTemplate.class);
@@ -166,9 +148,7 @@ public class JmsTemplateAutoConfigurationTests {
@Test
public void testActiveMQOverriddenPool() {
- this.context = new AnnotationConfigApplicationContext();
- this.context
- .register(TestConfiguration.class, JmsTemplateAutoConfiguration.class);
+ this.context = createContext(TestConfiguration.class);
EnvironmentTestUtils.addEnvironment(this.context, "spring.activemq.pooled:true");
this.context.refresh();
JmsTemplate jmsTemplate = this.context.getBean(JmsTemplate.class);
@@ -179,14 +159,12 @@ public class JmsTemplateAutoConfigurationTests {
assertEquals(jmsTemplate.getConnectionFactory(), pool);
ActiveMQConnectionFactory factory = (ActiveMQConnectionFactory) pool
.getConnectionFactory();
- assertEquals("vm://localhost", factory.getBrokerURL());
+ assertEquals(ActiveMQProperties.DEFAULT_EMBEDDED_BROKER_URL, factory.getBrokerURL());
}
@Test
public void testActiveMQOverriddenPoolAndStandalone() {
- this.context = new AnnotationConfigApplicationContext();
- this.context
- .register(TestConfiguration.class, JmsTemplateAutoConfiguration.class);
+ this.context = createContext(TestConfiguration.class);
EnvironmentTestUtils.addEnvironment(this.context, "spring.activemq.pooled:true",
"spring.activemq.inMemory:false");
this.context.refresh();
@@ -198,16 +176,13 @@ public class JmsTemplateAutoConfigurationTests {
assertEquals(jmsTemplate.getConnectionFactory(), pool);
ActiveMQConnectionFactory factory = (ActiveMQConnectionFactory) pool
.getConnectionFactory();
- assertEquals("tcp://localhost:61616", factory.getBrokerURL());
+ assertEquals(ActiveMQProperties.DEFAULT_NETWORK_BROKER_URL, factory.getBrokerURL());
}
@Test
public void testActiveMQOverriddenPoolAndRemoteServer() {
- this.context = new AnnotationConfigApplicationContext();
- this.context
- .register(TestConfiguration.class, JmsTemplateAutoConfiguration.class);
+ this.context = createContext(TestConfiguration.class);
EnvironmentTestUtils.addEnvironment(this.context, "spring.activemq.pooled:true",
- "spring.activemq.inMemory:false",
"spring.activemq.brokerUrl:tcp://remote-host:10000");
this.context.refresh();
JmsTemplate jmsTemplate = this.context.getBean(JmsTemplate.class);
@@ -221,6 +196,13 @@ public class JmsTemplateAutoConfigurationTests {
assertEquals("tcp://remote-host:10000", factory.getBrokerURL());
}
+ private AnnotationConfigApplicationContext createContext(Class>... additionalClasses) {
+ AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
+ context.register(additionalClasses);
+ context.register(ActiveMQAutoConfiguration.class, JmsTemplateAutoConfiguration.class);
+ return context;
+ }
+
@Configuration
protected static class TestConfiguration {
}
diff --git a/spring-boot-dependencies/pom.xml b/spring-boot-dependencies/pom.xml
index acfc4222e7..d9d2b382dc 100644
--- a/spring-boot-dependencies/pom.xml
+++ b/spring-boot-dependencies/pom.xml
@@ -388,6 +388,11 @@