[Spring] @RestControllerAdvice를 이용한 Spring 예외 처리 방법 - (2/2)
예외 처리는 robust한 애플리케이션을 만드는데 매우 중요한 부분을 차지한다. Spring 프레임워크는 매우 다양한 에러 처리 방법을 제공하는데, 앞선 포스팅에서 @RestControllerAdvice를 사용해야 하는 이유에 대해서 자세히 알아보았다. 이번 포스팅에서는 @RestControllerAdvice를 이용해 에러를 처리하는 방법에 대해서 구현하면서 살펴보도록 하자. 1. ControllerAdvice와 RestControllerAdvice [ ControllerAdvice와 RestControllerAdvice ] Spring은 전역적으로 예외를 처리할 수 있는 @ControllerAdvice와 @RestControllerAdvice 어노테이션을 각각 Spring3.2, Spring4.3부터 ..
Spring
2022. 1. 14. 10:00