运行spring cloud项目,提示错误:
Method has too many Body parameters
应从以下两方面考虑:
- get请求:
如果是get请求,需要在请求的参数前加上@RequestParam注解修饰(@RequestParam可以修饰多个参数,但不能修饰整个对象)。
- post请求:
在feign中,可以有多个@RequestParam,但只可以有一个@RequestBody。如:
public boolean save(@RequestBody User user,@RequestParam("userId") String userId,@RequestParam("userName") String userName);