微信获得access-token
微信获得access-token
RestTemplate template = new RestTemplate(); String appid = "aa"; String secret = "bb"; String tokenUrl = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid="+appid+"&secret="+secret; @SuppressWarnings("rawtypes") Map map = template.getForObject(tokenUrl, Map.class); Object obj1 = map.get("access_token"); if(obj1 == null){ // access_token ERROR! return ""; } String accessToken = (String) obj1;