Open
Description
Spring Boot 2.2.0.RELEASE
Using @Async
returning a Future cannot be canceled if the @Async
method is called from a @SpyBean
.
From debugging, it seems the @Async
aspect is called twice, first before mockito handling method call then after Mockito calls method so the returned Future
is invalid.
Sample project: https://github.com/cdalexndr/spring-boot-issue-18771
Just run gradlew test