Bird
0
0

If a Spring Boot controller method throws an IllegalArgumentException but no @ExceptionHandler is defined for it, what will happen?

medium📝 Conceptual Q5 of 15
Spring Boot - Exception Handling
If a Spring Boot controller method throws an IllegalArgumentException but no @ExceptionHandler is defined for it, what will happen?
AThe exception will propagate and result in a default error response with HTTP status 500.
BThe exception will be silently ignored and the method will return normally.
CSpring Boot will automatically handle it with a 200 OK response.
DThe application will crash and stop running.
Step-by-Step Solution
Solution:
  1. Step 1: Understand default exception handling

    If no handler is defined, Spring Boot returns a default error response with status 500.
  2. Step 2: Eliminate incorrect options

    Exceptions are not ignored or converted to 200 OK automatically, nor do they crash the app.
  3. Final Answer:

    The exception will propagate and result in a default error response with HTTP status 500. -> Option A
  4. Quick Check:

    Unhandled exceptions return 500 error [OK]
Quick Trick: Unhandled exceptions cause HTTP 500 error [OK]
Common Mistakes:
  • Assuming exceptions are ignored
  • Expecting automatic 200 OK response
  • Thinking app crashes completely

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes