[Spring] ControllerAdvice
1. ControllerAdvice 예외 발생 시 매번 try-catch를 해도 되지만 귀찮다. @ControllerAdvice은 비즈니스 로직과 예외 처리를 완전히 분리시켜줌과 동시에 원하는 곳에 원하는 방식으로 예외를 처리할 수 있게 해 준다. spring 6.1 버전부터는 throwExceptionIfNoHandlerFound의 default 값은 true라서 별도로 설정하지 않아도 된다. 이제는 모든 예외를 한 곳에서 처리할 수 있다! – 2024.07.24 추가 RestController + ControllerAdvice = RestControllerAdvice … 더 읽기