diff --git a/spring-boot-cli/samples/jms.groovy b/spring-boot-cli/samples/jms.groovy index 3875a189b3..da29ff47d3 100644 --- a/spring-boot-cli/samples/jms.groovy +++ b/spring-boot-cli/samples/jms.groovy @@ -1,8 +1,9 @@ package org.test -@Grab("org.apache.activemq:activemq-all:5.4.0") -@Grab("activemq-pool") +@Grab("spring-boot-starter-hornetq") +@Grab("hornetq-jms-server") import java.util.concurrent.CountDownLatch +import org.hornetq.jms.server.config.impl.JMSQueueConfigurationImpl @Log @Configuration @@ -19,7 +20,6 @@ class JmsExample implements CommandLineRunner { new DefaultMessageListenerContainer([ connectionFactory: connectionFactory, destinationName: "spring-boot", - pubSubDomain: true, messageListener: new MessageListenerAdapter(new Receiver(latch:latch)) {{ defaultListenerMethod = "receive" }} @@ -28,7 +28,7 @@ class JmsExample implements CommandLineRunner { void run(String... args) { def messageCreator = { session -> - session.createObjectMessage("Greetings from Spring Boot via ActiveMQ") + session.createObjectMessage("Greetings from Spring Boot via HornetQ") } as MessageCreator log.info "Sending JMS message..." jmsTemplate.send("spring-boot", messageCreator) @@ -44,4 +44,9 @@ class Receiver { log.info "Received ${message}" latch.countDown() } + + @Bean JMSQueueConfigurationImpl springBootQueue() { + new JMSQueueConfigurationImpl('spring-boot', null, false) + } + } diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/JmsCompilerAutoConfiguration.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/JmsCompilerAutoConfiguration.java index e2e89c2733..3c0b04b96f 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/JmsCompilerAutoConfiguration.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/JmsCompilerAutoConfiguration.java @@ -28,6 +28,7 @@ import org.springframework.boot.groovy.EnableJmsMessaging; * {@link CompilerAutoConfiguration} for Spring JMS. * * @author Greg Turnquist + * @author Stephane Nicoll */ public class JmsCompilerAutoConfiguration extends CompilerAutoConfiguration { @@ -41,8 +42,7 @@ public class JmsCompilerAutoConfiguration extends CompilerAutoConfiguration { @Override public void applyDependencies(DependencyCustomizer dependencies) throws CompilationFailedException { - dependencies.add("spring-jms", "geronimo-jms_1.1_spec"); - + dependencies.add("spring-jms", "jms-api"); } @Override diff --git a/spring-boot-cli/src/test/java/org/springframework/boot/cli/SampleIntegrationTests.java b/spring-boot-cli/src/test/java/org/springframework/boot/cli/SampleIntegrationTests.java index fa813f698d..47e14dc2e7 100644 --- a/spring-boot-cli/src/test/java/org/springframework/boot/cli/SampleIntegrationTests.java +++ b/spring-boot-cli/src/test/java/org/springframework/boot/cli/SampleIntegrationTests.java @@ -134,12 +134,10 @@ public class SampleIntegrationTests { } @Test - @Ignore("Intermittent failure on CI. See #323") public void jmsSample() throws Exception { String output = this.cli.run("jms.groovy"); assertTrue("Wrong output: " + output, - output.contains("Received Greetings from Spring Boot via ActiveMQ")); - FileUtils.deleteDirectory(new File("activemq-data"));// cleanup ActiveMQ cruft + output.contains("Received Greetings from Spring Boot via HornetQ")); } @Test