Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在我的 Feign Client 界面中使用 @RequestLine 注释。它只需要请求方法和路径,有没有办法设置它产生和消费的媒体类型?
这就是我所拥有的,有什么建议可以添加它产生和消费的媒体类型吗?
@RequestLine("POST /metrics-service/rest/addMetric") MyEntity sendEntity(@RequestBody MyEntity toSend);
是的,很简单,你可以添加
@Headers("Content-Type: application/json")
查看参考:https ://github.com/Netflix/feign