删除Weixin4jSettings配置类 & fixed #89 #90 #91

This commit is contained in:
jinyu
2016-08-22 13:07:06 +08:00
parent 4420adca99
commit 0356484f44
42 changed files with 1098 additions and 853 deletions
@@ -8,37 +8,31 @@
<!-- 微信接口代理~start -->
<bean id="weixinProxy" class="com.foxinmy.weixin4j.mp.WeixinProxy">
<!-- 公众号信息:不声明则默认使用weixin4j.properties配置的weixin4j.account字段 -->
<constructor-arg>
<bean class="com.foxinmy.weixin4j.setting.Weixin4jSettings">
<!-- 公众号信息:不声明则默认使用weixin4j.properties配置的weixin4j.account字段 -->
<constructor-arg>
<bean class="com.foxinmy.weixin4j.model.WeixinAccount">
<constructor-arg index="0" value="公众账号的appid" />
<constructor-arg index="1" value="公众账号的appsecret" />
</bean>
</constructor-arg>
<!-- token存储:不声明则默认使用文件方式(FileTokenStorager)保存 -->
<!-- property name="tokenStorager">
<bean class="com.foxinmy.weixin4j.token.RedisTokenStorager">
<constructor-arg type="redis.clients.jedis.JedisPool">
<bean class="redis.clients.jedis.JedisPool">
<constructor-arg index="0">
<bean class="redis.clients.jedis.JedisPoolConfig">
<property name="maxTotal" value="${redis.maxTotal}" />
<property name="maxIdle" value="${redis.maxIdle}" />
<property name="maxWaitMillis" value="${redis.maxWaitMillis}" />
<property name="testOnBorrow" value="${redis.testOnBorrow}" />
</bean>
</constructor-arg>
<constructor-arg index="1" value="${redis.host}" />
<constructor-arg index="2" value="${redis.port}" />
<constructor-arg index="3" value="${redis.timeout}" />
<bean class="com.foxinmy.weixin4j.model.WeixinAccount">
<constructor-arg index="0" value="公众账号的appid" />
<constructor-arg index="1" value="公众账号的appsecret" />
</bean>
</constructor-arg>
<!-- token存储:不声明则默认使用文件方式(FileCacheStorager)保存,请自行引入redis配置文件 -->
<constructor-arg>
<bean class="com.foxinmy.weixin4j.cache.RedisCacheStorager">
<constructor-arg type="redis.clients.jedis.JedisPool">
<bean class="redis.clients.jedis.JedisPool">
<constructor-arg index="0">
<bean class="redis.clients.jedis.JedisPoolConfig">
<property name="maxTotal" value="${redis.maxTotal}" />
<property name="maxIdle" value="${redis.maxIdle}" />
<property name="maxWaitMillis" value="${redis.maxWaitMillis}" />
<property name="testOnBorrow" value="${redis.testOnBorrow}" />
</bean>
</constructor-arg>
<constructor-arg index="1" value="${redis.host}" />
<constructor-arg index="2" value="${redis.port}" />
<constructor-arg index="3" value="${redis.timeout}" />
</bean>
</property -->
<!-- 临时目录:weixin4j调用某些接口时需要用到的临时目录,不声明则获取顺序为:weixin4j.properties#weixin4j.tmpdir->`java.io.tmp` -->
<property name="tmpdir" value="/tmp/weixin4j" />
</constructor-arg>
</bean>
</constructor-arg>
</bean>
@@ -47,19 +41,15 @@
<!-- 微信支付接口代理~start -->
<bean id="weixinPayProxy" class="com.foxinmy.weixin4j.payment.WeixinPayProxy">
<constructor-arg>
<bean class="com.foxinmy.weixin4j.setting.Weixin4jSettings">
<!-- 商户信息:不声明则默认使用weixin4j.properties配置的weixin4j.account字段 -->
<constructor-arg>
<bean class="com.foxinmy.weixin4j.model.WeixinPayAccount">
<constructor-arg index="0" value="公众账号的appid" />
<constructor-arg index="1" value="商户平台的支付密钥:paySignkey" />
<constructor-arg index="2" value="商户平台的商户ID:mchId" />
</bean>
</constructor-arg>
<!-- 商户信息:不声明则默认使用weixin4j.properties配置的weixin4j.account字段 -->
<bean class="com.foxinmy.weixin4j.model.WeixinPayAccount">
<constructor-arg index="0" value="公众账号的appid" />
<constructor-arg index="1" value="商户平台的支付密钥:paySignkey" />
<constructor-arg index="2" value="商户平台的商户ID:mchId" />
<!-- 以下是证书配置,如用到请配置 -->
<constructor-arg index="3" value="加载支付证书文件的密码(默认为商户号)" />
<!-- ca证书:调用某些支付接口(如退款、红包)需要用到的证书文件,不声明则获取顺序为:weixin4j.properties#weixin4j.certificate.file->`classpath:ca.p12` -->
<property name="certificateFile" value="/path/to/certificate/file" />
<!-- 临时目录:weixin4j调用某些接口时需要用到的临时目录,不声明则获取顺序为:weixin4j.properties#weixin4j.tmpdir->`java.io.tmp` -->
<property name="tmpdir" value="/tmp/weixin4j" />
<constructor-arg index="4" value="/path/to/certificate/file" />
</bean>
</constructor-arg>
</bean>
@@ -67,18 +57,19 @@
<!-- 微信消息服务~start -->
<bean
class="com.foxinmy.weixin4j.example.server.Weixin4jServerStartupWithThread" init-method="start" destroy-method="stop">
class="com.foxinmy.weixin4j.example.server.Weixin4jServerStartupWithThread"
init-method="start" destroy-method="stop">
<!-- 端口号 微信暂时只支持80端口 所以需要自己把微信被动消息请求转发(nginx等)到这个端口上来 -->
<constructor-arg index="0" value="30000" />
<!-- token信息 -->
<constructor-arg index="1">
<!-- 明文模式 -->
<bean class="com.foxinmy.weixin4j.util.AesToken">
<constructor-arg index="0" value="weixin4j" />
<constructor-arg index="0" value="开发者Token" />
</bean>
<!-- 加密模式 -->
<!-- bean class="com.foxinmy.weixin4j.util.AesToken"> <constructor-arg
index="0" value="公众号的应用ID(appid/corpid)" /> <constructor-arg index="1" value="开发者Token"
<!-- bean class="com.foxinmy.weixin4j.util.AesToken"> <constructor-arg
index="0" value="公众号的应用ID(appid/corpid)" /> <constructor-arg index="1" value="开发者Token"
/> <constructor-arg index="2" value="解密的EncodingAESKey" /> </bean -->
</constructor-arg>
<!-- 处理微信消息的全限包名 -->
@@ -1,18 +1,25 @@
# weixin4j\u7684\u914d\u7f6e\u6587\u4ef6:\u5982\u679c\u6ca1\u6709\u8bf7\u6784\u9020\u76f8\u5e94\u53c2\u6570\u4f20\u5165 \u5982\u679c\u6709\u8bf7\u4fdd\u8bc1\u5728classpath\u7684\u6839\u76ee\u5f55\u4e0b
# \u516c\u4f17\u53f7\u4fe1\u606f \u8bf7\u6309\u9700\u586b\u5199
weixin4j.account={"id":"wx4ab8f8de58159a57","secret":"1d4eb0f4bf556aaed539f30ed05ca795",\
"components":[{"id":"\u5e94\u7528\u7ec4\u4ef6\u7684id","secret":"\u5e94\u7528\u7ec4\u4ef6\u7684secret"}],\
"mchId":"\u5fae\u4fe1\u5546\u6237\u53f7 \u5fae\u4fe1\u652f\u4ed8\u65f6\u9700\u8981\u586b\u5165",\
"certificateKey":"\u52a0\u8f7d\u652f\u4ed8\u8bc1\u4e66\u6587\u4ef6\u7684\u5bc6\u7801 \u5982\u679c\u4e0d\u586b\u5199\u5219\u9ed8\u8ba4\u83b7\u53d6mchId\u4f5c\u4e3a\u5bc6\u7801",\
"certificateFile":"\u5fae\u4fe1\u652f\u4ed8\u67d0\u4e9b\u63a5\u53e3(\u9000\u6b3e\u7b49)\u9700\u8981\u7684ca\u8bc1\u4e66\u5b58\u653e\u7684\u8def\u5f84,classpath\u8def\u5f84\u4e0b\u53ef\u4ee5\u8fd9\u4e48\u5199classpath:xxxxx.p12,\u4e3a\u7a7a\u65f6\u5219\u83b7\u53d6classpath\u6839\u76ee\u5f55\u4e0b\u7684ca.p12\u6587\u4ef6",\
"paySignKey":"\u5fae\u4fe1\u652f\u4ed8\u4e2d\u8c03\u7528API\u7684\u5bc6\u94a5 \u5fae\u4fe1\u652f\u4ed8\u65f6\u9700\u8981\u586b\u5165"}
# weixin4j\u7684\u4e34\u65f6\u76ee\u5f55
# \u53ef\u80fd\u5b58\u653etoken\u6587\u4ef6\u3001\u4e8c\u7ef4\u7801\u6587\u4ef6\u3001\u5a92\u4f53\u6587\u4ef6\u3001\u5bf9\u8d26\u5355\u6587\u4ef6\u7b49
# \u4e3a\u7a7a\u65f6\u5219\u83b7\u53d6java.io.tmpdir\u4e34\u65f6\u76ee\u5f55
weixin4j.tmpdir=
# \u5fae\u4fe1\u652f\u4ed8\u67d0\u4e9b\u63a5\u53e3\u9700\u8981\u7684ca\u8bc1\u4e66\u5b58\u653e\u7684\u5b8c\u6574\u8def\u5f84
# classpath\u8def\u5f84\u4e0b\u53ef\u4ee5\u8fd9\u4e48\u5199
# weixin4j.certificate.file=classpath:xxxxx.p12
# \u4e3a\u7a7a\u65f6\u5219\u83b7\u53d6classpath\u6839\u76ee\u5f55\u4e0b\u7684ca.p12\u6587\u4ef6
weixin4j.certificate.file=/tmp/weixin4j/xxxxx.p12
# \u516c\u4f17\u53f7\u5fae\u4fe1\u7f51\u9875oauth\u6388\u6743\u91cd\u5b9a\u5411\u7684url(\u5728\u4f7f\u7528OauthApi\u65f6\u586b\u5199,\u4e5f\u53ef\u81ea\u5b9a\u4e49\u4f20\u5165)
# \u8be6\u89c1\uff1ahttps://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140842&token=&lang=zh_CN
weixin4j.user.oauth.redirect.uri=
# \u7528\u6237oauth\u6388\u6743\u540e\u91cd\u5b9a\u5411\u7684url(\u5728\u4f7f\u7528OauthApi\u65f6\u586b\u5199)
weixin4j.user.oauth.redirect.uri=
# \u7f51\u7ad9\u626b\u63cf\u767b\u9646oauth\u6388\u6743\u91cd\u5b9a\u5411\u7684url(\u5728\u4f7f\u7528OauthApi\u65f6\u586b\u5199,\u4e5f\u53ef\u81ea\u5b9a\u4e49\u4f20\u5165)
# \u8be6\u89c1\uff1ahttps://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=open1419316505&token=&lang=zh_CN
weixin4j.open.user.oauth.redirect.uri=
# \u7b2c\u4e09\u65b9\u7ec4\u4ef6\u6388\u6743\u91cd\u5b9a\u5411\u7684url(\u5728\u4f7f\u7528ComponentApi\u65f6\u586b\u5199,\u4e5f\u53ef\u81ea\u5b9a\u4e49\u4f20\u5165)
# \u8be6\u89c1\uff1ahttps://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=open1453779503&token=&lang=zh_CN
weixin4j.component.oauth.redirect.uri=
# \u7b2c\u4e09\u65b9\u7ec4\u4ef6\u4ee3\u66ff\u6388\u6743\u516c\u4f17\u53f7\u53d1\u8d77\u7f51\u9875\u6388\u6743\u91cd\u5b9a\u5411\u7684url(\u5728\u4f7f\u7528ComponentApi\u65f6\u586b\u5199,\u4e5f\u53ef\u81ea\u5b9a\u4e49\u4f20\u5165)
# \u8be6\u89c1\uff1ahttps://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=open1419318590&token=&lang=zh_CN
weixin4j.component.user.oauth.redirect.uri=