https://blog.csdn.net/liuchuanhong1/article/details/54728681
多参数问题
- @RequestMapping(value="/user/name", method=RequestMethod.GET)
-
User findByUsername(final String userName, final String address);
启动服务的时候,会报如下异常:
Caused by: java.lang.IllegalStateException: Method has too many Body parameters: public abstract com.chhliu.spri
ngboot.restful.vo.User com.chhliu.springboot.restful.feignclient.UserFeignClient.findByUsername(java.lang.String,java.lang.String) 异常原因:当使用Feign时,如果发送的是get请求,那么需要在请求参数前加上@RequestParam注解修饰,Controller里面可以不加该注解修饰。
上面问题的解决方案如下:
@RequestMapping(value="/user/name", method=RequestMethod.GET)
User findByUsername(@RequestParam("userName") final String userName, @RequestParam("address") final String address);
原文地址:https://www.cnblogs.com/wsnan/p/12069378.html
时间: 2024-10-10 14:34:36