@PathVariable这个注解里面没有指定value报错
来源:7-1 使用Feign实现远程HTTP调用

慕九州8772281
2019-09-14
为什么feign 那节我的@PathVariable这个注解里面没有指定value会报PathVariable annotation was empty on param 0 这是什么原因呢? 我看你的都没有报错
写回答
1回答
-
大目
2019-09-14
您好,课上使用的版本没有这个问题(cloud greenwich + cloud alibaba 0.9.0),其他部分版本是可能有这个问题的。
在课程配套手记:https://www.imooc.com/article/289005 里面也有讲到。
解决方案,在PathVariable注解上添加参数,例如:
@GetMapping("/users/{id}") UserDTO findById(@PathVariable("id") Integer id);
00
相似问题