- @ExceptionHandler(SomeException.class) targets a specific exception type
- One @ControllerAdvice class can handle exceptions for ALL controllers
- Combine with a custom ErrorResponse DTO for consistent JSON error shape
Exception Handling with @ControllerAdvice
@ControllerAdvice centralizes exception handling so you don't repeat try/catch blocks in every controller.