본문 바로가기
반응형

#exception2

스프링부트 라이브러리 만들기, spring boot auto configuration, 공통 exception 처리 라이브러리 만들기 스프링부트 라이브러리 만들기, spring boot auto configuration, 공통 exception 처리 라이브러리 만들기 배경 최근에, 여러 spring boot 프로젝트를 개발하는 대형프로젝트를 진행하고 있습니다. 그런데, 각 spring boot에서 공통적으로 코드를 사용하는 부분이 있습니다. 예를 들어, exception 처리와 같은 부분입니다. controller쪽에서 exception을 발생시키면 아래와 같은 json 결과를 http response로 보내고, http status 는 500에러를 발생하고자 하였습니다. {"message":"ERROR_INTERNAL","result":null} 이를 처리하기 위해서는 스프링 부트 프로젝트에 spring boot aop를 적용하여 처.. 2023. 10. 19.
[Spring] Spring에서 Exception 제대로 처리하기, Spring Exception 전역 예외 처리, Spring exception 처리, Spring exception handler, ExceptionHandler, 스프링 예외처리, Spring exception 예외처리, Spring exception Spring에서 Exception 제대로 처리하기, Spring Exception 전역 예외 처리, Spring exception 처리, Spring exception handler, ExceptionHandler, 스프링 예외처리, Spring exception 예외처리, Spring exception Spring에서의 예외처리 방법 Spring에서는 Java에서의 try catch 블록을 사용하는것 외에 예외를 처리할 수 있는 간단한 방법을 제공합니다. 대표적으로 @ExceptionHandler라는 annotation(어노테이션)을 이용하여 예외처리할 수 있습니다. 또한, 이를 프로젝트 전체에 적용하기 위해, @ControllerAdvice라는 annotation 을 사용할 수 있습니다. 이에 대한 .. 2022. 7. 31.
반응형