Support suspending handler methods in Spring MVC
This commit adds support for Kotlin Coroutines suspending functions to Spring MVC, by converting those to a Mono that can then be handled by the asynchronous request processing feature. It also optimizes Coroutines detection with the introduction of an optimized KotlinDetector.isSuspendingFunction() method that does not require kotlin-reflect. Closes gh-23611
This commit is contained in:
@@ -139,8 +139,7 @@ public class InvocableHandlerMethod extends HandlerMethod {
|
||||
try {
|
||||
ReflectionUtils.makeAccessible(getBridgedMethod());
|
||||
Method method = getBridgedMethod();
|
||||
if (KotlinDetector.isKotlinReflectPresent() && KotlinDetector.isKotlinType(method.getDeclaringClass())
|
||||
&& CoroutinesUtils.isSuspendingFunction(method)) {
|
||||
if (KotlinDetector.isSuspendingFunction(method)) {
|
||||
value = CoroutinesUtils.invokeSuspendingFunction(method, getBean(), args);
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user