티스토리 뷰
Spring - @ControllerAdvice
-
예외처리, 바인딩설정, 모델 객체를 모든 컨트롤러 전반에 적용하고 싶은경우 사용한다.
-
@ControllerAdivce
- Spring 3.2 부터 지원
- Spring 4.0 이후부터 scope 지정이 가능하다.
- 특정 애노테이션을 가진 Controller에 적용
- 특정 패키지 이하의 Controller에만 적용
- 특정 클래스 타입에만 적용
- @RestControllerAdvice도 지원한다.
- @ExceptionHandler
- @InitBinder
- @ModelAttributes
- 등의 메서드들을 정의한다면, 모든 Controller 에 적용된다.
- https://docs.spring.io/spring/docs/5.1.8.RELEASE/spring-framework-reference/web.html#mvc-ann-controller-advice
Web on Servlet Stack
Spring Web MVC is the original web framework built on the Servlet API and has been included in the Spring Framework from the very beginning. The formal name, “Spring Web MVC,” comes from the name of its source module (spring-webmvc), but it is more commonl
docs.spring.io
'Spring' 카테고리의 다른 글
Spring - REST DOCS (0) | 2019.08.15 |
---|---|
Spring - HATEOAS (0) | 2019.08.12 |
Spring - MVC @ExceptionHandler (0) | 2019.08.01 |
Spring - MVC @InitBinder (0) | 2019.08.01 |
Spring - MVC @ModelAttribute의 다른사용방법 (0) | 2019.08.01 |
댓글