Skip to main content

@ControllerAdvice

Learn @ControllerAdvice (Exception Handling, Spring MVC) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.

Fresher Notes @ControllerAdvice is a Spring component that shares @ExceptionHandler , @ModelAttribute and @InitBinder methods across many controllers. Purpose : keep error handling in one class instead of copying it into every controller. Registration : it is a @Component , so component scanning finds it; no other configuration is needed.

More lessons in Exception Handling