代码
@RequestMapping(value = "/feign/rule/getApplicationPulishRule", method = RequestMethod.GET) List<RuleManageEntity> getApplicationPulishRule(String siteId,String status);
报错
Caused by: java.lang.IllegalStateException: Method has too many Body parameters: public abstract java.util.List com.hvit.application.yst.feign.UserFeign.getApplicationPulishRule(java.lang.String,java.lang.String)
异常原因:当使用Feign时,如果发送的是get请求,那么需要在请求参数前加上@RequestParam注解修饰,Controller里面可以不加该注解修饰 ,@RequestParam可以修饰多个,@RequestParam是用来修饰参数,不能用来修饰整个对象。
注意:@RequestParam Content-Type 为 application/x-www-form-urlencoded 而这种是默认的
解决办法
参数加上@RequestParam
@RequestMapping(value = "/feign/rule/getApplicationPulishRule", method = RequestMethod.GET) @MacIgnore List<RuleManageEntity> getApplicationPulishRule(@RequestParam("siteId") String siteId, @RequestParam("status")String status);