resttemple远程post调用
Posted misted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了resttemple远程post调用相关的知识,希望对你有一定的参考价值。
1,尽量使用JsonString作为传输数据(发送与接收)
2,restTemplate方法上@LoadBalance注解存在时,必须配置负载节点。 如未配置,去掉此注解
3,实体参数需重新包装:
public HttpEntity<String> getParam(String json){
HttpHeaders requestHeaders = new HttpHeaders();
requestHeaders.setContentType(MediaType.APPLICATION_JSON);
return new HttpEntity<String>(json, requestHeaders);
}
以上是关于resttemple远程post调用的主要内容,如果未能解决你的问题,请参考以下文章
resttemplate远程接口调用 传一个map 怎么调用map参数
SpringCloud03 Ribbon知识点 Feign知识点利用RestTemplate+Ribbon调用远程服务提供的资源利用feign调用远程服务提供的资源