diff --git a/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/core/RabbitAdmin.java b/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/core/RabbitAdmin.java index c184539051..92b236dfcd 100644 --- a/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/core/RabbitAdmin.java +++ b/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/core/RabbitAdmin.java @@ -125,7 +125,7 @@ public class RabbitAdmin implements AmqpAdmin, ApplicationContextAware, Applicat private ApplicationEventPublisher applicationEventPublisher; - private boolean declareCollections = true; + private boolean declareCollections = false; private TaskExecutor taskExecutor = new SimpleAsyncTaskExecutor(); diff --git a/src/reference/asciidoc/amqp.adoc b/src/reference/asciidoc/amqp.adoc index 8db4aec9d7..2d427272d7 100644 --- a/src/reference/asciidoc/amqp.adoc +++ b/src/reference/asciidoc/amqp.adoc @@ -3970,6 +3970,11 @@ public static class Config { } ----- +IMPORTANT: In versions prior to 2.1, you could declare multiple `Declarable` s by defining beans of type `Collection`. +This can cause undesirable side effects in some cases, because the admin has to iterate over all `Collection` beans. +This feature is now disabled in favor of `Declarables` as discussed above. +You can revert to the previous behavior by setting the `RabbitAdmin` property `declareCollections` to `true`. + [[conditional-declaration]] ===== Conditional Declaration diff --git a/src/reference/asciidoc/whats-new.adoc b/src/reference/asciidoc/whats-new.adoc index 099a74c2db..c93ea48138 100644 --- a/src/reference/asciidoc/whats-new.adoc +++ b/src/reference/asciidoc/whats-new.adoc @@ -40,6 +40,7 @@ See <> for more information. The `RabbitAdmin` will discover beans of type `Declarables` (which is a container for `Declarable` - `Queue`, `Exchange`, `Binding` objects) and declare the contained objects on the broker. Users are discouraged from using the old mechanism of declaring `>` etc and should use `Declarables` beans instead. +By default, the old mechanism is disabled. See <> for more information. ===== RabbitTemplate Changes