-parameters 参数的使用 解决 Feign PathVariable annotation was empty on param 0

在使用 FeignClient 如果参数没有给默认名字
@PathVariable("districtId") Long districtId

比如

@FeignClient("tool-service")
public interface DistrictClient {

    @GetMapping("/rpc/district/{districtId}")
    ResBody<DistrictFullDto> getFullPath(@PathVariable Long districtId);
}

会报错:

Feign PathVariable annotation was empty on param 0

只是jdk在编译后用arg0,arg1...代替了原来的参数
导致Feign没有找到参数
只需要开启保留参数设置即可
如图:

注意: 要重新编译

posted @ 2019-07-09 19:48  懒企鹅  阅读(3043)  评论(0编辑  收藏  举报