From d6550ed324100895b0ea896d8d11c042d41c3527 Mon Sep 17 00:00:00 2001 From: Oleg Zhurakousky Date: Tue, 4 Jun 2024 08:36:53 +0200 Subject: [PATCH] GH-2956 Fix assertion for multiple binders Resolves #2956 --- .../cloud/stream/binder/AbstractMessageChannelBinder.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 6b966fd75..d00b95a9c 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 @@ -267,8 +267,8 @@ private String resolveFromDefaultBinder() { 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(); + Assert.isTrue(binderTypes.entrySet().size() <= 1, "More than one binder types found, but no binder specified on the binding"); + return (binderTypes.entrySet().size() < 1) ? null : binderTypes.keySet().iterator().next(); } /**