Exception Mapping1 스프링에서 Exception 핸들러 매핑하기 @ExceptionHandler WelcomeController 클래스에 있는 두 메서드는 모두 @ExceptionHandler 어노테이션을 붙였습니다. 첫 번째 handle 메서드는 CustomException 예외 처리 전용 메서드이며, 두 번째 handleDefault 메서드는 일반 예외 처리 메서드 역할을 합니다. 두 메서드 모두 에러 상황에 따라 맞는 렌더링 할 뷰 이름을 반환하고 있습니다. @ExceptionHandler는 특정 컨트롤러 안에서 예외가 발생한 경우에만 예외를 매핑하는 문제점이 있습니다. @Controller public class WelcomeController { @ExceptionHandler(CustomException.class) public String handle(C.. 2019. 7. 25. 이전 1 다음