File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed
spring-aop/src/main/java/org/springframework/aop/interceptor Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -88,7 +88,7 @@ public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
88
88
89
89
/**
90
90
* Determine the specific executor to use when executing the given method.
91
- * @return the executor to use (never {@code null})
91
+ * @return the executor to use (or {@code null}, but just if no default executor has been set )
92
92
*/
93
93
protected AsyncTaskExecutor determineAsyncExecutor (Method method ) {
94
94
AsyncTaskExecutor executor = this .executors .get (method );
@@ -102,8 +102,7 @@ protected AsyncTaskExecutor determineAsyncExecutor(Method method) {
102
102
this .beanFactory , Executor .class , qualifier );
103
103
}
104
104
else if (executorToUse == null ) {
105
- throw new IllegalStateException ("No executor qualifier specified and no default executor set on " +
106
- getClass ().getSimpleName () + " either" );
105
+ return null ;
107
106
}
108
107
executor = (executorToUse instanceof AsyncTaskExecutor ?
109
108
(AsyncTaskExecutor ) executorToUse : new TaskExecutorAdapter (executorToUse ));
Original file line number Diff line number Diff line change @@ -83,7 +83,13 @@ public Object invoke(final MethodInvocation invocation) throws Throwable {
83
83
Method specificMethod = ClassUtils .getMostSpecificMethod (invocation .getMethod (), targetClass );
84
84
specificMethod = BridgeMethodResolver .findBridgedMethod (specificMethod );
85
85
86
- Future <?> result = determineAsyncExecutor (specificMethod ).submit (
86
+ AsyncTaskExecutor executor = determineAsyncExecutor (specificMethod );
87
+ if (executor == null ) {
88
+ throw new IllegalStateException (
89
+ "No executor specified and no default executor set on AsyncExecutionInterceptor either" );
90
+ }
91
+
92
+ Future <?> result = executor .submit (
87
93
new Callable <Object >() {
88
94
@ Override
89
95
public Object call () throws Exception {
You can’t perform that action at this time.
0 commit comments