使用springboot的RestTemplate发送post请求,为啥报如下错误,代码如下?

public class HttpClientTemplate {

public static String sendPOSTRequest(String url, Map<String, String> params) {

RestTemplate client = new RestTemplate();

HttpHeaders headers = new HttpHeaders();

headers.setContentType(MediaType.APPLICATION_JSON);

HttpEntity<Map<String, String>> r = new HttpEntity<>(params, headers);

String data= client.postForObject(url, r, String.class);

return data;

}

}

以上是 使用springboot的RestTemplate发送post请求,为啥报如下错误,代码如下? 的全部内容, 来源链接: utcz.com/p/944745.html

回到顶部