Feign调用服务出现‘Content-Type‘ cannot contain wildcard type ‘*‘
Feign带日期参数调用服务的时候报错: ‘Content-Type’ cannot contain wildcard type ‘*’,应该是fastjson进行日期转换时没指定json类型导致。
解决办法:
在Feign接口的请求上加上: consumes = MediaType.APPLICATION_JSON_VALUE表示用application/json的方式接收即可,如:
@PostMapping(value = "/report/queryBReport", consumes = MediaType.APPLICATION_JSON_VALUE)
public AjaxResult queryReport(@RequestBody QueryReportRequest request);
本文介绍了解决Feign调用服务时因日期参数导致的‘Content-Type’cannot contain wildcard type ‘*’错误的方法。该问题源于fastjson在转换日期时未指定JSON类型。通过在Feign接口上指定MediaType.APPLICATION_JSON_VALUE可以有效解决此问题。

1928

被折叠的 条评论
为什么被折叠?



