I'm writing tests for my Async method, annotated with @Async. I'm trying to disable Async by using below configuration class:
@Profile("!integ-test")
@Configuration
@EnableAsync
public class AsyncConfiguration {}
Calling code:
@Autowired private ApiDelegate apiDelegate;
apiDelegate.exportResources(searchContext);
Method:
@Async
public void exportResources(
SearchContext searchContext,
) {}
Spring boot version: 2.3.12.RELEASE
The problem is the method is still being executed asynchronously. There is no place else where @EnableAsync is placed. I've also tried removing @EnableAsync altogether, but the method remains asynchronous. There seems to be no effect of removing @EnableAsync. Please help. Thanks.