2
저는 스프링 부트 응용 프로그램을 작성하고 있습니다. 그리고 지금 예외 처리를 구현하고 있습니다.Java SpringBoot 예외 처리
다음과 같은 문제가 있습니다.
내 예외 핸들러
는 다음과 같다 :@ControllerAdvice
public class SpecialExceptionHandler {
@ExceptionHandler(MissingServletRequestParameterException.class)
@ResponseStatus(HttpStatus.BAD_REQUEST)
public ResponseObject missingServletErrorHandler(HttpServletRequest req, MissingServletRequestParameterException exception) {
//do something
return responseObject;
}}
그리고
@ControllerAdvice
public class GeneralExceptionHandler {
@ExceptionHandler(Exception.class)
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
public ResponseObject defaultErrorHandler(HttpServletRequest req, Exception exception) {
// do something
return responseObject;
}}
보이는 일반적인 예외 처리기를 가지고하지만 문제가 생겼 : 내 응용 프로그램은 항상 대신 GeneralExceptionHandler으로 실행 특수 예외 처리기 (예 : 'GeneralExceptionHandler'에서 'zGeneralExceptionHandler'로 변경) 다음에 알파벳순으로 나오는 이름으로 GeneralExceptionHandler 클래스의 이름을 변경하지 않는 한 특수 처리기입니다.
이 문제를 어떻게 해결할 수 있습니까?