SpringBoot:錯誤Missing URI template variable '幣種ID' for method parameter of type int


調試接口時候,Missing URI template variable '幣種ID' for method parameter of type int。

1     @ApiOperation(value = "銷毀金額")
2     @PostMapping("/destroy/{currency_id}")
3     public Result destroyMoney(@PathVariable(value="幣種ID") int currency_id) {
4         return fundsService.destroyMoney(currency_id);
5     }
6         

后來發現,不能在@PathVariable有value和name,下面這樣就行:

1     @ApiOperation(value = "銷毀金額")
2     @PostMapping("/destroy/{currency_id}")
3     public Result destroyMoney(@PathVariable("currency_id") int currency_id) {
4         return fundsService.destroyMoney(currency_id);
5     }

如果需要對參數說明,可以@ApiParam。


免責聲明!

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



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