diff --git a/spring-cloud-modules/spring-cloud-openfeign/src/main/java/com/baeldung/cloud/openfeign/config/ClientConfiguration.java b/spring-cloud-modules/spring-cloud-openfeign/src/main/java/com/baeldung/cloud/openfeign/config/ClientConfiguration.java index 55c27dde2f..fe731e83dc 100644 --- a/spring-cloud-modules/spring-cloud-openfeign/src/main/java/com/baeldung/cloud/openfeign/config/ClientConfiguration.java +++ b/spring-cloud-modules/spring-cloud-openfeign/src/main/java/com/baeldung/cloud/openfeign/config/ClientConfiguration.java @@ -1,15 +1,14 @@ package com.baeldung.cloud.openfeign.config; +import org.apache.http.entity.ContentType; +import org.springframework.context.annotation.Bean; + import feign.Logger; import feign.RequestInterceptor; import feign.auth.BasicAuthRequestInterceptor; import feign.codec.ErrorDecoder; import feign.okhttp.OkHttpClient; -import org.apache.http.entity.ContentType; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -@Configuration public class ClientConfiguration { @Bean @@ -19,7 +18,7 @@ public class ClientConfiguration { @Bean public ErrorDecoder errorDecoder() { - return new ErrorDecoder.Default(); + return new CustomErrorDecoder(); } @Bean diff --git a/spring-cloud-modules/spring-cloud-openfeign/src/main/java/com/baeldung/cloud/openfeign/oauthfeign/OAuthFeignConfig.java b/spring-cloud-modules/spring-cloud-openfeign/src/main/java/com/baeldung/cloud/openfeign/oauthfeign/OAuthFeignConfig.java index 70ca45d86e..dbce5b4383 100644 --- a/spring-cloud-modules/spring-cloud-openfeign/src/main/java/com/baeldung/cloud/openfeign/oauthfeign/OAuthFeignConfig.java +++ b/spring-cloud-modules/spring-cloud-openfeign/src/main/java/com/baeldung/cloud/openfeign/oauthfeign/OAuthFeignConfig.java @@ -1,13 +1,16 @@ package com.baeldung.cloud.openfeign.oauthfeign; -import feign.RequestInterceptor; import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.security.oauth2.client.*; +import org.springframework.security.oauth2.client.AuthorizedClientServiceOAuth2AuthorizedClientManager; +import org.springframework.security.oauth2.client.OAuth2AuthorizedClientManager; +import org.springframework.security.oauth2.client.OAuth2AuthorizedClientProvider; +import org.springframework.security.oauth2.client.OAuth2AuthorizedClientProviderBuilder; +import org.springframework.security.oauth2.client.OAuth2AuthorizedClientService; import org.springframework.security.oauth2.client.registration.ClientRegistration; import org.springframework.security.oauth2.client.registration.ClientRegistrationRepository; -@Configuration +import feign.RequestInterceptor; + public class OAuthFeignConfig { public static final String CLIENT_REGISTRATION_ID = "keycloak";