Improve JMS support in cli

This commit deprecates the proprietary EnableJmsMessaging annotation in
favour of the standard @EnableJms introduced as of Spring 4.1. This
commit also updates the sample and adds an integration test as the
feature was actually broken.

Fixes gh-1456
This commit is contained in:
Stephane Nicoll
2014-08-28 14:25:14 +02:00
parent bf249d4205
commit affb202e74
5 changed files with 56 additions and 26 deletions

View File

@@ -28,29 +28,32 @@ import org.springframework.boot.groovy.EnableJmsMessaging;
* {@link CompilerAutoConfiguration} for Spring JMS.
*
* @author Greg Turnquist
* @author Stephane Nicoll
*/
public class JmsCompilerAutoConfiguration extends CompilerAutoConfiguration {
@Override
public boolean matches(ClassNode classNode) {
// Slightly weird detection algorithm because there is no @Enable annotation for
// Spring JMS
return AstUtils.hasAtLeastOneAnnotation(classNode, "EnableJmsMessaging");
return AstUtils.hasAtLeastOneAnnotation(classNode, "EnableJms") ||
AstUtils.hasAtLeastOneAnnotation(classNode, "EnableJmsMessaging");
}
@Override
public void applyDependencies(DependencyCustomizer dependencies)
throws CompilationFailedException {
dependencies.add("spring-jms", "geronimo-jms_1.1_spec");
dependencies.add("spring-jms", "jms-api");
}
@Override
public void applyImports(ImportCustomizer imports) throws CompilationFailedException {
imports.addStarImports("javax.jms", "org.springframework.jms.core",
imports.addStarImports("javax.jms",
"org.springframework.jms.annotation",
"org.springframework.jms.config",
"org.springframework.jms.core",
"org.springframework.jms.listener",
"org.springframework.jms.listener.adapter").addImports(
EnableJmsMessaging.class.getCanonicalName());
"org.springframework.jms.listener.adapter")
.addImports(EnableJmsMessaging.class.getCanonicalName());
}
}

View File

@@ -26,10 +26,13 @@ import org.springframework.boot.cli.compiler.autoconfigure.JmsCompilerAutoConfig
/**
* Pseudo annotation used to trigger {@link JmsCompilerAutoConfiguration}.
*
* @deprecated since 1.2.0 in favor of {@code EnableJms}
*/
@Target(ElementType.TYPE)
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Deprecated
public @interface EnableJmsMessaging {
}