1:在web,xml中配置servlet
<strong><span style="font-size:18px;"> <servlet> <servlet-name>initServlet</servlet-name> <servlet-class> com.wizincloud.wx.manager.InitServlet </servlet-class> <!-- 配置获取access_token所需参数appid和appsecret --> <init-param> <param-name>appid</param-name> <param-value>wxee1894c6b5a44b8e</param-value> </init-param> <init-param> <param-name>appsecret</param-name> <param-value>7a938414e38c9f007608c40bbb6478fc</param-value> </init-param> <load-on-startup>0</load-on-startup> </servlet> </span></strong>
配置了appid(应用ID)和appsecret(应用秘钥)。
2:servlet实现
3:获取access_token的线程