[JAVA][FEIGN] Put back hardcoded HTTP Client but without the performance issue created in 8484. This is fix for 21187 (#22905)

* BUG:21187 put back hardcoded client without the issue created in 8484

* BUG:21187 put back hardcoded client without the issue created in 8484

---------

Co-authored-by: Sri Sushma Karra <srisushmakarra@Sris-MacBook-Air.local>
This commit is contained in:
Sri Sushma Karra
2026-02-07 00:48:00 +08:00
committed by GitHub
parent 07d60e010a
commit 459f359bf4
5 changed files with 36 additions and 0 deletions

View File

@@ -29,6 +29,7 @@ import feign.RequestInterceptor;
import feign.form.FormEncoder;
import feign.jackson.JacksonDecoder;
import feign.jackson.JacksonEncoder;
import feign.okhttp.OkHttpClient;
import feign.slf4j.Slf4jLogger;
import org.openapitools.client.auth.HttpBasicAuth;
import org.openapitools.client.auth.HttpBearerAuth;
@@ -53,11 +54,13 @@ public class ApiClient {
protected String basePath = "http://petstore.swagger.io:80/v2";
protected Map<String, RequestInterceptor> apiAuthorizations;
protected Feign.Builder feignBuilder;
private static final OkHttpClient OK_HTTP_CLIENT = new OkHttpClient();
public ApiClient() {
apiAuthorizations = new LinkedHashMap<String, RequestInterceptor>();
objectMapper = createObjectMapper();
feignBuilder = Feign.builder()
.client(OK_HTTP_CLIENT)
.encoder(new FormEncoder(new JacksonEncoder(objectMapper)))
.decoder(new ApiResponseDecoder(objectMapper))
.errorDecoder(new ApiErrorDecoder())