Java中使用feign遇到的坑

1.解析接口返回的数据时,失败了。

feign.codec.DecodeException: Could not extract response: no suitable HttpMessageConverter found for response type [java.util.List<com.mfw.cnts.trustedapi.server.dao.domain.TodoUser>] and content type [text/html;charset=utf-8]

参考文章:https://www.jianshu.com/p/5461eb5386a8

文章中说,如果提供服务的接口是php,并且自己可以控制的话,修改header头即可

 php如何修改header头中的Content-Type

参考地址:https://blog.csdn.net/hsd2012/article/details/51085585

在输出数据之前,添加 一段代码

header('Content-type: application/json');

修改之后的样子

修改完后,再请求数据,就可以了

原文地址:https://www.cnblogs.com/wangkongming/p/13645932.html