Improve RabbitMQ support in CLI
This commit deprecates the proprietary EnableRabbitMessaging annotation in favour of the standard @EnableRabbit introduced as of Spring Rabbit 1.4. Fixes gh-1494
This commit is contained in:
@@ -28,14 +28,14 @@ import org.springframework.boot.groovy.EnableRabbitMessaging;
|
||||
* {@link CompilerAutoConfiguration} for Spring Rabbit.
|
||||
*
|
||||
* @author Greg Turnquist
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class RabbitCompilerAutoConfiguration extends CompilerAutoConfiguration {
|
||||
|
||||
@Override
|
||||
public boolean matches(ClassNode classNode) {
|
||||
// Slightly weird detection algorithm because there is no @Enable annotation for
|
||||
// Integration
|
||||
return AstUtils.hasAtLeastOneAnnotation(classNode, "EnableRabbitMessaging");
|
||||
return AstUtils.hasAtLeastOneAnnotation(classNode, "EnableRabbit")
|
||||
|| AstUtils.hasAtLeastOneAnnotation(classNode, "EnableRabbitMessaging");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -47,7 +47,9 @@ public class RabbitCompilerAutoConfiguration extends CompilerAutoConfiguration {
|
||||
|
||||
@Override
|
||||
public void applyImports(ImportCustomizer imports) throws CompilationFailedException {
|
||||
imports.addStarImports("org.springframework.amqp.rabbit.core",
|
||||
imports.addStarImports("org.springframework.amqp.rabbit.annotation",
|
||||
"org.springframework.amqp.rabbit.core",
|
||||
"org.springframework.amqp.rabbit.config",
|
||||
"org.springframework.amqp.rabbit.connection",
|
||||
"org.springframework.amqp.rabbit.listener",
|
||||
"org.springframework.amqp.rabbit.listener.adapter",
|
||||
|
||||
@@ -26,10 +26,13 @@ import org.springframework.boot.cli.compiler.autoconfigure.RabbitCompilerAutoCon
|
||||
|
||||
/**
|
||||
* Pseudo annotation used to trigger {@link RabbitCompilerAutoConfiguration}.
|
||||
*
|
||||
* @deprecated since 1.2.0 in favor of {@code EnableRabbit}
|
||||
*/
|
||||
@Target(ElementType.TYPE)
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Deprecated
|
||||
public @interface EnableRabbitMessaging {
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user