Bird
0
0

You added @Async to a method but it still runs synchronously. What is the most likely cause?

medium📝 Debug Q6 of 15
Spring Boot - Async Processing
You added @Async to a method but it still runs synchronously. What is the most likely cause?
AThe @EnableAsync annotation is missing in the configuration
BThe method is private or called from within the same class
CThe method returns void instead of CompletableFuture
DThe application is running in debug mode
Step-by-Step Solution
Solution:
  1. Step 1: Understand @Async proxy limitations

    @Async works via proxies and does not intercept calls to private methods or self-calls within the same class.
  2. Step 2: Identify cause from options

    The method is private or called from within the same class correctly identifies that private or internal calls prevent async behavior.
  3. Final Answer:

    The method is private or called from within the same class -> Option B
  4. Quick Check:

    @Async fails on private/self calls [OK]
Quick Trick: Async won't work on private or self-called methods [OK]
Common Mistakes:
  • Forgetting @EnableAsync (valid but not most likely here)
  • Thinking return type must be CompletableFuture
  • Blaming debug mode

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes