Skip to content

Commit

Permalink
Fix wrong return type when invoking Async-annotated
Browse files Browse the repository at this point in the history
  • Loading branch information
anaconda874 committed Nov 25, 2024
1 parent f5ff84a commit a076999
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package org.springframework.aop.interceptor;

import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executor;
Expand Down Expand Up @@ -125,7 +126,16 @@ public Object invoke(final MethodInvocation invocation) throws Throwable {
return null;
};

return doSubmit(task, executor, invocation.getMethod().getReturnType());
return doSubmit( task, executor, determineReturnType( invocation, userMethod ) );
}

private static Class<?> determineReturnType(MethodInvocation invocation, Method userMethod) {
Method originalMethod = invocation.getMethod();
if( Modifier.isAbstract( originalMethod.getModifiers() ) ) {
return userMethod.getReturnType();
}

return originalMethod.getReturnType();
}

/**
Expand Down

0 comments on commit a076999

Please sign in to comment.