Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Thu May 19 20:38:34 CST 2022
There was an unexpected error (type=Internal Server Error, status=500).
404 : [{"timestamp":"2022-05-19T12:38:34.866+0000","status":404,"error":"Not Found","message":"No message available","path":"/payment/get31"}]
org.springframework.web.client.HttpClientErrorException$NotFound: 404 : [{"timestamp":"2022-05-19T12:38:34.866+0000","status":404,"error":"Not Found","message":"No message available","path":"/payment/get31"}]
原本的代码
@GetMapping("/consumer/payment/get/{id}")
public CommonResult getPayment(@PathVariable Long id){
return restTemplate.getForObject(PAYMENT_URL+"/payment/get"+id,CommonResult.class,id);
}
找了好久,发现错误是“/payment/get”后面少了一个反斜杠“/”,要改成如下
restTemplate.getForObject(PAYMENT_URL+"/payment/get/"+id,CommonResult.class,id);
纯粹是粗心。



