1.遇见的问题
在使用resttemplate发送请求的时候,由于url中带了参数,所有想进行DECodeUrl然后发送,但是在Springboot中这个操作已经封装好了,于是出现了请求两次加密问题,导致出现问题
2.解决办法
1.不加密直接发送请求
这种解决方案不做过多说明
2.不使用自动加密路径参数
UriComponentsBuilder uriComponentsBuilder = UriComponentsBuilder.fromHttpUrl(realUrl);
URI uri = uriComponentsBuilder.build(true).toUri();
return restTemplate.getForObject(uri, DidiVo.class);
这样一番操作,问题解决。
参考原文:Spring RestTemplate发送请求时 自动对参数进行urlencode的问题_wangooo的博客-CSDN博客