2. springframework 中功能集合
1. RestTemplate 请求
@Autowired
private RestTemplate restTemplate;
GET方式:
Map<String, Object> result = restTemplate.getForObject(accessTokenUrl, Map.class);
POST方式:
// 请求参数
Map<String, Object> params = new HashMap<>();
// 发送路径
String sendTemplateUrl = "";
// 开始发送请求
HttpHeaders headers = new HttpHeaders();
headers.add("Content-Type", "application/json");
HttpEntity<Object> entity = new HttpEntity(params, headers);
Map resultMap = restTemplate.postForObject(sendTemplateUrl, entity, Map.class);