fix: 修正feign client 调用异常问题
diff --git a/aggr/admin/pom.xml b/aggr/admin/pom.xml
index f7fb563..013b8c2 100644
--- a/aggr/admin/pom.xml
+++ b/aggr/admin/pom.xml
@@ -88,9 +88,14 @@
<!-- openfeign's dependency -->
<dependency>
+ <groupId>com.netflix.feign</groupId>
+ <artifactId>feign-httpclient</artifactId>
+ </dependency>
+
+ <!-- <dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
- </dependency>
+ </dependency> -->
<dependency>
diff --git a/common/core/pom.xml b/common/core/pom.xml
index 0193355..b0a7e56 100644
--- a/common/core/pom.xml
+++ b/common/core/pom.xml
@@ -38,7 +38,12 @@
<artifactId>spring-cloud-starter-openfeign</artifactId>
<optional>true</optional>
</dependency>
-
+ <dependency>
+ <groupId>com.netflix.feign</groupId>
+ <artifactId>feign-httpclient</artifactId>
+ <optional>true</optional>
+ </dependency>
+
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
diff --git a/common/core/src/main/java/com/supwisdom/institute/backend/common/core/feign/FeignClientBuilder.java b/common/core/src/main/java/com/supwisdom/institute/backend/common/core/feign/FeignClientBuilder.java
index 2fe606f..181ad10 100644
--- a/common/core/src/main/java/com/supwisdom/institute/backend/common/core/feign/FeignClientBuilder.java
+++ b/common/core/src/main/java/com/supwisdom/institute/backend/common/core/feign/FeignClientBuilder.java
@@ -11,6 +11,7 @@
import org.springframework.util.ResourceUtils;
import feign.Client;
+import feign.httpclient.ApacheHttpClient;
@Slf4j
@lombok.Builder
@@ -27,11 +28,11 @@
public Client client() {
if (!enabled) {
- return new Client.Default(null, null);
+ return new ApacheHttpClient();
}
if (keyStore == null || keyStore.isEmpty()) {
- return new Client.Default(null, null);
+ return new ApacheHttpClient();
} else {
try {
SSLContextBuilder sslContextBuilder = SSLContexts.custom();
@@ -55,7 +56,7 @@
SSLSocketFactory sslSocketFactory = sslContext.getSocketFactory();
- Client trustSSLSockets = new Client.Default(sslSocketFactory, new NoopHostnameVerifier());
+ Client trustSSLSockets = new Client.Default(sslSocketFactory, new NoopHostnameVerifier()); // FIXME: feign Client
log.info("feignClient load with ssl.");
return trustSSLSockets;
} catch (Exception e) {
@@ -63,7 +64,7 @@
}
}
- return new Client.Default(null, null);
+ return new ApacheHttpClient();
}
}
diff --git a/pom.xml b/pom.xml
index babdfb8..0d4638d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -135,6 +135,12 @@
<version>${project.version}</version>
</dependency>
+ <!-- 使用Apache HttpClient替换Feign原生httpclient -->
+ <dependency>
+ <groupId>com.netflix.feign</groupId>
+ <artifactId>feign-httpclient</artifactId>
+ <version>8.17.0</version>
+ </dependency>
<dependency>
<groupId>mysql</groupId>