SpringCloud Feign报错:Method has too many Body parameters
feign多参数问题
GET请求
错误写法
@RequestMapping(value="/test", method=RequestMethod.GET) void test(final String name, final int age);
正确写法
@RequestMapping(value="/test", method=RequestMethod.GET) void test(@RequestParam("name") final String name,@RequestParam("age") final int age);
POST请求
错误写法
public int save(@RequestBody final Person p, @RequestBody final UserModel user);
feign中你可以有多个@RequestParam,但只能有不超过一个@RequestBody。
正确写法
public int save(@RequestBody final Person p,@RequestParam("userId") String userId,@RequestParam("userTel") String userTel);

浙公网安备 33010602011771号