在?解bug,挺急的。
1. 添加依賴
不使用maven的大佬,自己去找下其他的吧。
依賴查找
<!-- https://mvnrepository.com/artifact/io.github.openfeign/feign-httpclient -->
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-httpclient</artifactId>
<version>10.4.0</version>
</dependency>
2. 添加描述。
在Feign接口上的方法的@RequstMapping或是@GetMapping註解加上 consumes = MediaType.APPLICATION_JSON_UTF8_VALUE。
示例:
/**
* @author: san
* @date: 2020/6/12
* @description:
* @version: 1.0
*/
@FeignClient(name = "m-service", path = "/test", fallbackFactory = m.class)
public interface test{
@GetMapping(consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
Response<SimplePageImpl<mDTO>> getMarketerByPage(Pageable pageable);
}
3.傳遞多個對象,加@SpringQueryMap註解
/**
* @author: san
* @date: 2020/6/12
* @description:
* @version: 1.0
*/
@FeignClient(name = "m-service", path = "/test", fallbackFactory = m.class)
public interface test{
@GetMapping(consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
Response<SimplePageImpl<mDTO>> getMByPage(@SpringQueryMap Pageable pageable, MQueryRequest mQueryRequest);
}
4.總結說明
全程改動只需改Feign層代碼即可。