Feign调用:Caused by: java.lang.IllegalStateException: Method has too many Body parameters

错误提示信息

异常: java.lang.IllegalStateException: Method has too many Body parameters
翻译:java.lang.IllegalStateException:方法具有太多的Body参数

解决方案:当使用Feign时,如果发送的是get请求,那么需要在请求参数前加上@RequestParam注解修饰,Controller里面可以不加该注解修饰。

@GetMapping("/basicinfo/user/isOwnerByUserIdAndVin")
TspResultVO isOwner(@RequestParam("userId") Long userId, @RequestParam("vin") String vin);

这个是Spring底层校验,需要注意@RequestParam注解中必须给value值不给会出现另外的异常。

Caused by: java.lang.IllegalStateException: RequestParam.value() was empty on parameter 0
  •  

你可能感兴趣的:(Feign调用:Caused by: java.lang.IllegalStateException: Method has too many Body parameters)