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