![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
springcloud
tino.tang
share for myself
展开
-
OpenFeignClient根据环境变量设置动态host
场景一个环境的微服务需要调用多个host地址的同一类型接口,需要根据参数反问不同host地址的接口解决办法以springcloud openFeign为例,将第一个参数设置为:java.net.URI,如: /** * /loki/api/v1/push is the endpoint used to send log entries to Loki. The default behavior is for * the POST body to be a snappy-compr原创 2021-12-21 14:13:14 · 1770 阅读 · 0 评论 -
OpenFeignClient用Object接收text/plain类型的返回报错
报错Could not extract response: no suitable HttpMessageConverter found forresponse type [classxxxx] and content type [text/plain]原因返回类型Content-Type不是application/json,而是text/plain,无法反序列化成Object类型,如图spring cloud OpenFeign本质上使用的是okHttpClient进行请求,如果是text原创 2021-12-21 14:03:23 · 3842 阅读 · 2 评论