环境介绍
java:17
SpringBoot:3.2.0
SpringCloud:2023.0.0
knife4j : 4.4.0
开始工作
pom文件引入配置
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents.client5</groupId>
<artifactId>httpclient5</artifactId>
<version>5.3</version>
</dependency>
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-hc5</artifactId>
<version>13.1</version>
</dependency>
application.yml 中添加配置
spring:
cloud:
openfeign:
httpclient:
enabled: true
okhttp:
enabled: false
启动服务
在 feign.SynchronousMethodHandler类中的executeAndDecode方法的response = this.client.execute(request, options); 代码打断点。
调用feign接口。进入断点后查看client配置。