From 07d28f51ea77189594796d2b44f95ce449d0dac9 Mon Sep 17 00:00:00 2001 From: Soby Chacko Date: Thu, 20 Apr 2023 13:19:23 -0400 Subject: [PATCH] Binder name in actuator binding endpoints - Fixing an issue where binder name is broken in bindings endpoint when default-binder property is provided with multiple binders on the classpath. Resolves https://github.com/spring-cloud/spring-cloud-stream/issues/2716 --- .../cloud/stream/binder/AbstractMessageChannelBinder.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binder/AbstractMessageChannelBinder.java b/core/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binder/AbstractMessageChannelBinder.java index bb60ddc64..035ec8d35 100644 --- a/core/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binder/AbstractMessageChannelBinder.java +++ b/core/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binder/AbstractMessageChannelBinder.java @@ -222,6 +222,9 @@ public abstract class AbstractMessageChannelBinder binderTypes = binderTypeRegistry.getAll(); + if (binderTypes.entrySet().size() > 1 && getBindingServiceProperties().getDefaultBinder() != null) { + return getBindingServiceProperties().getDefaultBinder(); + } Assert.isTrue(binderTypes.entrySet().size() == 1, "More than one binder types found, but no binder specified on the binding"); return binderTypes.keySet().iterator().next(); } @@ -232,6 +235,9 @@ public abstract class AbstractMessageChannelBinder