Bird
0
0

Why does this async method not run asynchronously?

medium📝 Debug Q7 of 15
Spring Boot - Async Processing

Why does this async method not run asynchronously?

@Async
public void call() {
  this.call();
}
ABecause calling the method on <code>this</code> bypasses Spring proxy and disables async
BBecause recursive calls are not allowed in async methods
CBecause <code>@Async</code> only works on static methods
DBecause the method must return a Future to be async
Step-by-Step Solution
Solution:
  1. Step 1: Understand Spring proxy mechanism for @Async

    Spring uses proxies to intercept calls and run async methods in separate threads.
  2. Step 2: Analyze effect of calling method on this

    Calling this.call() bypasses the proxy, so @Async is ignored and method runs synchronously.
  3. Final Answer:

    Because calling the method on this bypasses Spring proxy and disables async -> Option A
  4. Quick Check:

    Self-calls bypass proxy, no async run [OK]
Quick Trick: Self-calls bypass proxy, so @Async won't run [OK]
Common Mistakes:
  • Thinking recursion disables async
  • Believing @Async requires static methods
  • Assuming Future return is mandatory

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes