1.1
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.RestTemplate;
1.2
public static String getTemplateMessageSend(RestTemplate restTemplate) {
String accessTokenUrl = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential";
String appID = "wx";
String secret = "90f";
String path = String.format("%s&appid=%s&secret=%s", accessTokenUrl, appID, secret);
ResponseEntity<String> entity = restTemplate.getForEntity(path, String.class);
JSONObject responseObj = JSON.parseObject(entity.getBody());
String access_token = responseObj.getString("access_token");
return access_token;
}
1.3