Feign接收文件流错误no suitable HttpMessageConverter found解决办法

错误信息

通过Feign调用微服务其他组件接口,报错如下:

 no suitable HttpMessageConverter found for response type [class com.common.web.model.Page] and content type [image/jpeg;charset=utf-8]

或者

no suitable HttpMessageConverter found for response type [class com.common.web.model.Page] and content type [text/plain;charset=utf-8]

此接口的作用是以文件流形式返回结果,以供文件下载、预览等。

解决方式

应该以Response的方式接收文件流。 参考: Spring Cloud Feign如何获得接口返回的文件流

© 版权声明
THE END
喜欢就支持一下吧
点赞1 分享