伪装中不存在必需的长参数'userId'

时间:2019-06-25 06:12:45

标签: spring-cloud spring-cloud-feign

我像这样在Spring Cloud伪装中调用get操作:

Long loginUserId = RequestContext.getLoginId();
Long userId = loginUserId;
Response<WalletResponse> walletRecord = feignClientWalletRecordController.getWalletRecordByUserId(userId);

但是api抛出此错误:

Caused by: org.springframework.web.bind.MissingServletRequestParameterException: Required Long parameter 'userId' is not present

当我从curl调用时:

curl http://localhost:11002/wallet?userId=2

它工作正常!!!

伪装调用缺少什么?这是我的服务器端代码:

@RequestMapping(value="/wallet")
@FeignClient(name = "soa-wallet-service")
public interface IFeignClientWalletRecordController {
    @GetMapping
    Response<WalletResponse> getWalletRecordByUserId(@RequestParam("userId") Long userId);

}

0 个答案:

没有答案