mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-10-10 17:29:17 +00:00
Use proper return type in AsyncExecutionInterceptor
See gh-33957
This commit is contained in:
+12
-1
@@ -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;
|
||||
@@ -60,6 +61,7 @@ import org.springframework.lang.Nullable;
|
||||
* @author Juergen Hoeller
|
||||
* @author Chris Beams
|
||||
* @author Stephane Nicoll
|
||||
* @author Bao Ngo
|
||||
* @since 3.0
|
||||
* @see org.springframework.scheduling.annotation.Async
|
||||
* @see org.springframework.scheduling.annotation.AsyncAnnotationAdvisor
|
||||
@@ -125,7 +127,16 @@ public class AsyncExecutionInterceptor extends AsyncExecutionAspectSupport imple
|
||||
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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user