其他分享
首页 > 其他分享> > RestTemplate的postForEntity方法传递数组,将集合转换成json字符串

RestTemplate的postForEntity方法传递数组,将集合转换成json字符串

作者:互联网

public Object blackList(List<SerSpecialtyLine> serSpecialtyLine) {
HttpHeaders blackHeaders = new HttpHeaders();
String token = getTokenId();
blackHeaders.add("Content-Type", BLOGIC_CONTENT_TYPE);
blackHeaders.add("x-auth-token", token);
HttpEntity<String> blackEntity = new HttpEntity<>(JSON.toJSONString(serSpecialtyLine), blackHeaders);
ResponseEntity<Object> tokenResponse = restTemplate.postForEntity("", blackEntity, Object.class);
return tokenResponse.getBody();
}

标签:postForEntity,Object,RestTemplate,blackHeaders,blackEntity,json,add,token
来源: https://www.cnblogs.com/hmycl/p/16188768.html