java.lang.IllegalStateException: Method has too many Body parameters

feign调用异常:Method has too many Body parameters

解决方法:所有参数必须加上注解

Java

复制代码

1

@RequestMapping(value = "/spCommodity/commodityPage", method = RequestMethod.POST)

2

R goodsList(Page page, @RequestBody CommodityListQO commodityListQO);// 会报错


get请求:参数要加上注解@RequestParam

post请求:只能有一个@RequestBody,Page属于一个对象,可删除,其余的参数需要加上@RequestParam

feign调用的接口处可修改:

@PostMapping("/commodityPage")
    public R goodsList(@RequestBody CommodityListQO commodityListQO){
        Page<SpServiceCommodity> page = new Page<>();
        // 页数
        page.setCurrent(commodityListQO.getCurrent());
        // 每页显示条数
        page.setSize(commodityListQO.getSize());
上一篇:4-2 ADO.NET-查询和检索数据2


下一篇:CSS3制作文字背景图