The last param of AsyncExecutionAspectSupport.doSubmit is a return type, which can be get from the invocation. But in case of interface with paramter type like:

interface Service<O> {
  O doSomething();
}

class DefaultAsyncService implements Service<Future<String>> {
  @Override
  @Async
  public Future<String> doSomething() {
   return CompletableFuture.abc();
  }
}

@RestController
class Controller {
  @Autowire
  Service<Future<String>> service;

  @GetMapping
  public Future<String> api() {
    return service.doSomething();
  }
}

Return type retuned by invocation.getMethod().getReturnType() will be Object because we invoke doSomething by the interface, not by the impl. My PR try to fix that

Comment From: snicoll

Can you please add a unit test that exercise the scenario you've described?

Comment From: anaconda875

Can you please add a unit test that exercise the scenario you've described?

Hi @snicoll , you need a unit test which cover the fix/changes, or the unit test to reproduce the issue?

Comment From: snicoll

Isn't that the same thing? I'd like that we see the change covered by an actual test that shows the behavior you've described is now working.

Comment From: anaconda875

Isn't that the same thing? I'd like that we see the change covered by an actual test that shows the behavior you've described is now working.

Ok I will add it soon. Thank you

Comment From: anaconda875

I added unit test