我像这样在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);
}