Spring Cloud Feign 报:Method not annotated with HTTP method type (ex. GET, POST)

编程入门 行业动态 更新时间:2024-10-04 15:37:04

Spring Cloud <a href=https://www.elefans.com/category/jswz/34/1768189.html style=Feign 报:Method not annotated with HTTP method type (ex. GET, POST)"/>

Spring Cloud Feign 报:Method not annotated with HTTP method type (ex. GET, POST)

原因1:继承了BaseFeign  也就是说父类可能已经有相同的方法了,而你在子类又写了一个一样的方法

解决:检查是否有相同请求URL或者方法名一样的FEIGN请求

 

小记:

  如果被调用端,也就是controoler用了基础类型参数,如:public ResultDTO<T> getAllList(Integer page,Integer pageSize);

那么feign在调用时要加参数注解,如下:

 
  1. @RequestMapping(value = "/getList",method = RequestMethod.POST)

  2. public ResultDTO getList(@RequestParam("currentPage") Integer currentPage,@RequestParam("pageSize") Integer pageSize);

要加上@RequestParam 才能识别得到

更多推荐

Spring Cloud Feign 报:Method not annotated with HTTP method type (ex. GET, POST)

本文发布于:2024-02-27 23:41:55,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1767281.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Feign   Method   Spring   Cloud   annotated

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!