Feign Method has too many Body parameters
一般都是@RequestBody使用的问题,但是如果使用了@HeaderMap 也会导致这个问题,如下:
问题:
在 Feign 方法里面添加 Header 报 Method has too many Body parameters
@PostMapping(value = "/sendsms")
String sendSMS(@HeaderMap Map<String, Object> headerParam, @RequestBody Map<String, Object> bodyParam);
解决:
修改代码如下
@PostMapping(value = "/message/sendsms")
String sendSMS(@RequestHeader Map<String, Object> headerParam, @RequestBody Map<String, Object> bodyParam);
因为 RequestBody 是 Spring 的。HeaderMap 是 Feign的,HeaderMap改成 RequestHeader 都用 Spring 的就OK了。
转自:https://www.cnblogs.com/vipsoft/p/14758682.html