-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Description
@ExceptinHandler
특정컨트롤러에 대해서만 동작하는 예외 핸들링을 위한 어노테이션이다.- 또한 기본적으로 bean으로 등록되는게 아니다. 어노테이션을 보면 알 수 있다.
- 만약 @ControllerAdvice가 없다면 아래처럼 특정 컨트롤러 하위에서만 해당 예외를 처리할 수 있다.
-
@ControllerAdvice
- 기존에 특정 컨트롤러에 한정적이었던 @ExceptionHandler를 global controller에서 발생하는 예외를 핸들링할 수 있게 만들어주는 어노테이션이다.
- 실제 어노테이션 주석을보면 알 수 있다
* Specialization of {@link Component @Component} for classes that declare
* {@link ExceptionHandler @ExceptionHandler}, {@link InitBinder @InitBinder}, or
* {@link ModelAttribute @ModelAttribute} methods to be shared across
* multiple {@code @Controller} classes.
Reactions are currently unavailable