springCloud服務之間傳遞複雜參數

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. 接口實現寫法

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章