@ControllerAdvice

Web on Servlet Stack

https://jeong-pro.tistory.com/195

@ExceptionHandler

Web on Servlet Stack

@Controller
public class SimpleController {

    // ...

    @ExceptionHandler
    public ResponseEntity<String> handle(IOException ex) {
        // ...
    }
}
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.HandlerExceptionResolver]: Factory method 'handlerExceptionResolver' threw exception; nested exception is java.lang.IllegalStateException: No exception types mapped to public org.springframework.http.ResponseEntity chess.controller.ExceptionAdvice.handleException()

특정 예외에 대한 처리

@ExceptionHandler({FileSystemException.class, RemoteException.class})
public ResponseEntity<String> handle(IOException ex) {
    // ...
}