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');

修改之后的樣子

 

 

修改完后,再請求數據,就可以了

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM