@ExceptionHandler1 Spring Day 21 : @ExceptionHandler, @ControllerAdvice, Spring 예외처리 ResponseEntity HTTP response object 를 위한 Wrapper로 HTTP status code, HTTP headers, HTTP body 를 담아 response로 반환한다. @ExceptionHandler Spring에서 예외처리를 위한 애너테이션. 특정 Controller에서 발생한 예외를 처리하기 위해 사용되며, @ExceptionHandler 가 붙어있는 메서드는 Controller에서 예외가 발생했을 때 호출 되며, 해당 예외를 처리하는 로직을 가진다. AOP를 이용한 예외처리 방식이기때문에 각 메서드 마다 try catch할 필요없이 예외처리가 가능하다. 예외처리 로직은 필요한 곳에서 Error를 만들어서 던지고, 그 Error를 받는곳에.. 2024. 2. 22. 이전 1 다음