feign接口無法傳遞參數 (初學者)


//修改用戶信息
@PutMapping("user/update")
public Result update(@RequestBody User user);
一種是將所需要的數據類型放在請求體中 用@requestBody 來獲取

//發送短信驗證碼
@RequestMapping("/validateCode/send4retrieve/{telephone}")
public Result send4retrieve( @PathVariable("telephone") String telephone);
一種是將所需要的數據類型放在請求頭中 用@PathVariable 來獲取 restful風格
------------------------------------------------------------------------
注意在feign接口中 不管使用什么方式都需要在參數前面加注解;在contreller層可以省略的@PathVariable注解(單個參數) 在feign接口中必須有



 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM