feign3 Feign Client - Error Decoder 및 logger DemoFeignErrorDecoder public class DemoFeignErrorDecoder implements ErrorDecoder { private final ErrorDecoder errorDecoder = new Default(); @Override public Exception decode(String methodKey, Response response) { HttpStatus httpStatus = HttpStatus.resolve(response.status()); if (httpStatus == HttpStatus.NOT_FOUND) { System.out.println("[DemoFeignErrorDecoder] Http Status = " + httpStatus); throw.. Spring Boot/Feign Client 2023. 1. 15. Feign Client - Interceptor Feign Client의 인터셉터 설정을 해보겠습니다. 인터셉터의 경우 우리가 요청을 보낼 때 한 곳에서 요청에 필요로 하는 공통적인 설정을 할 수 있는 곳이라 생각하시면 됩니다. DemoFeignInterceptor @RequiredArgsConstructor(staticName = "of") public class DemoFeignInterceptor implements RequestInterceptor { @Override public void apply(RequestTemplate template) { //get 요청일 경우 if (template.method() == Request.HttpMethod.GET.name()) { System.out.println("[GET] [DemoFeignInt.. Spring Boot/Feign Client 2023. 1. 15. Feign Client 기본 구성 및 흐름 Feign 이란 ?선언적으로 사용할 수 있는 Clent이다. (= Feign is a declarative web service client. ) ref : https://docs.spring.io/spring-cloud-openfeign/docs/current/reference/html 이 글을 작성하게 된 이유는 백엔드 프로젝트를 하다 보면 외부 API와 통신을 할 일이 생기게 됩니다. 그럴 때 자주 사용하는 것이 HttpURLConnection이나 RestTemplate입니다. 두 개다 사용해봤지만 HttpURLConnection 은 HTTP 한번 호출하기 위해서 많은 코드를 작성해야 생산성이 떨어지는 단점이 있고 RestTemplate는 spring5부터는 Deprecated 되어 있습니다. 그래.. Spring Boot/Feign Client 2023. 1. 14. 이전 1 다음