diff --git a/spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/reactive/InvocableHandlerMethod.java b/spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/reactive/InvocableHandlerMethod.java index 3156c66a82..82571913e2 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/reactive/InvocableHandlerMethod.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/reactive/InvocableHandlerMethod.java @@ -205,14 +205,16 @@ public class InvocableHandlerMethod extends HandlerMethod { if (reactiveAdapter.isNoValue()) { return true; } - Type parameterType = returnType.getGenericParameterType(); - if (parameterType instanceof ParameterizedType type) { - if (type.getActualTypeArguments().length == 1) { - return Void.class.equals(type.getActualTypeArguments()[0]); - } + } + Type parameterType = returnType.getGenericParameterType(); + if (parameterType instanceof ParameterizedType type) { + if (type.getActualTypeArguments().length == 1) { + return Void.class.equals(type.getActualTypeArguments()[0]); } } - return false; + Method method = returnType.getMethod(); + return method != null && KotlinDetector.isSuspendingFunction(method) && + Void.TYPE.equals(returnType.getParameterType()); } }