-
Notifications
You must be signed in to change notification settings - Fork 17
5 wechat4j配置文件解读
vcdemon edited this page Jun 1, 2016
·
1 revision
wechat-framework的配置文件是wechat4j.properties。需要放置在项目src/java/resources目录下(即classpath路径下)。在wechat-core.jar包的根目录下找到wechat4j.properties.sample文件示例文件,你可以直接复制到项目src/java/resources目录下,改名即可使用。
wechat4j.properties配置文件的内容如下:
#you server url
wechat.url=
#you wechat token
wechat.token=token
#公众号的Token(令牌)
wechat.token=token
#公众号的AppID(应用ID)
wechat.appid=appid
#公众号的AppSecret(应用密钥)
wechat.appsecret=secret
#公众号的EncodingAESKey(消息加解密密钥)
wechat.encodingaeskey=encodingaeskey
#wechat access token server ,when you save in db,must implement you server class
#this class must extend org.sword.wechat4j.token.server.CustomerServer
#if no this property,then token server is default memery accesstoken server
wechat.accessToken.server.class=
#jsapi_ticket customer server class name,
#this class must extend org.sword.wechat4j.token.server.CustomerServer
#if no this property,then ticket server is default memery ticket server
wechat.ticket.jsapi.server.class=微信公众平台上你的服务器服务地址,实际意义不大,通常作为测试使用。
此配置项配置你在微信公众平台上的token,你可以登录微信公众平台,在开发模式下看到。
此项配置是消息秘钥,如果打开消息安全模式,则微信公众平台管理界面中会给你生成一个秘钥,配置这个秘钥即可。
此项配置是你的appid,你可以登录微信公众平台,在开发模式下看到。
此项配置是你的app secret信息,你可以登录微信公众平台,在开发模式下看到。
此项是用来配置获取accessToken的中控服务器程序。
- 如果不配置此项,那么获取
accesstoken使用的wechat4j默认的中控服务器,即AccessTokenMemServer,这样token是保存在内存中,如果过期了会去刷新一下得到新的token。 - 如果你需要将
accesstoken保存在数据库中,那么你就需要实现一个你自己的类来实现数据库操作,让后将你的类路径配置到此项中。并且在web.xml中配置一个监听器用来定时刷新accesstoken。具体的实现方法参见Accesstoken中控服务器实现
此项是用来支持js-sdk的。用来配置获取jsapi_ticket的中控服务器程序,配置上客户自定义的ticket管理程序类路径即可,配置方法同wechat.accessToken.server.class配置项