1. 在yml配置文件中添加
feign: # 服務之間可以傳遞對象參試
httpclient:
enabled: true
2. 添加pom
<!-- 配置feign 發送請求使用 httpclient,而不是java原生 --> <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpclient</artifactId> </dependency> <!-- 使用Apache HttpClient替換Feign原生httpclient --> <dependency> <groupId>com.netflix.feign</groupId> <artifactId>feign-httpclient</artifactId> <version>8.15.1</version> </dependency>
3. 接口寫法
4. 接口實現寫法