Bird
0
0

What will happen if an exception occurs inside a @Async method returning void without an AsyncUncaughtExceptionHandler configured?

medium📝 component behavior Q5 of 15
Spring Boot - Async Processing
What will happen if an exception occurs inside a @Async method returning void without an AsyncUncaughtExceptionHandler configured?
AThe exception will crash the application.
BThe exception will be silently swallowed and lost.
CThe exception will be logged by default and the application continues.
DThe exception will be propagated to the caller thread.
Step-by-Step Solution
Solution:
  1. Step 1: Default behavior for void async exceptions

    Without a custom AsyncUncaughtExceptionHandler, Spring uses the default SimpleAsyncUncaughtExceptionHandler which logs the exception at ERROR level.
  2. Step 2: Application behavior

    The exception is logged, and the application continues running without crashing.
  3. Final Answer:

    The exception will be logged by default and the application continues. -> Option C
  4. Quick Check:

    Void async no custom handler = Logged by default [OK]
Quick Trick: Spring logs unhandled void async exceptions by default [OK]
Common Mistakes:
  • Thinking exceptions are silently swallowed
  • Expecting exceptions to crash the app
  • Believing exceptions propagate to caller thread

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes