diff --git a/spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/reactive/AbstractMethodMessageHandler.java b/spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/reactive/AbstractMethodMessageHandler.java index 5fb60c9074faf1dc4661d4441775395e6e770505..bb0c3c31996b82f5ca449fde44e844cfa7abdfaa 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/reactive/AbstractMethodMessageHandler.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/reactive/AbstractMethodMessageHandler.java @@ -267,10 +267,6 @@ public abstract class AbstractMethodMessageHandler private void initHandlerMethods() { - if (this.applicationContext == null) { - logger.warn("No ApplicationContext available for detecting beans with message handling methods."); - return; - } if (this.handlers != null) { for (Object handler : this.handlers) { detectHandlerMethods(handler); @@ -281,6 +277,11 @@ public abstract class AbstractMethodMessageHandler logger.warn("[" + getBeanName() + "] Auto-detection of message handling methods is off."); return; } + if (this.applicationContext == null) { + logger.warn("No ApplicationContext available " + + "for auto-detection of beans with message handling methods."); + return; + } for (String beanName : this.applicationContext.getBeanNamesForType(Object.class)) { if (!beanName.startsWith(SCOPED_TARGET_NAME_PREFIX)) { Class beanType = null;