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在調用時要加參數註解,如下:

@RequestMapping(value = "/getList",method = RequestMethod.POST)
    public ResultDTO getList(@RequestParam("currentPage") Integer  currentPage,@RequestParam("pageSize") Integer pageSize);

要加上@RequestParam 才能識別得到

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章