|
1 | 1 | package com.github.config; |
2 | 2 |
|
| 3 | +import org.springframework.beans.factory.annotation.Value; |
3 | 4 | import org.springframework.context.annotation.Bean; |
4 | 5 | import org.springframework.context.annotation.Configuration; |
5 | 6 |
|
|
11 | 12 | /** |
12 | 13 | * Created by FirenzesEagle on 2016/5/30 0030. |
13 | 14 | * Email:liumingbo2008@gmail.com |
| 15 | + * |
| 16 | + * @author FirenzesEagle |
| 17 | + * @author BinaryWang |
14 | 18 | */ |
15 | 19 | @Configuration |
16 | 20 | public class MainConfig { |
17 | 21 |
|
18 | | - //TODO(user) 填写公众号开发信息 |
19 | | - //商站宝测试公众号 APP_ID |
20 | | - protected static final String APP_ID = ""; |
21 | | - //商站宝测试公众号 APP_SECRET |
22 | | - protected static final String APP_SECRET = ""; |
23 | | - //商站宝测试公众号 TOKEN |
24 | | - protected static final String TOKEN = ""; |
25 | | - //商站宝测试公众号 AES_KEY |
26 | | - protected static final String AES_KEY = ""; |
27 | | - |
28 | | - //商站宝微信支付商户号 |
29 | | - protected static final String PARTNER_ID = ""; |
30 | | - //商站宝微信支付平台商户API密钥(https://pay.weixin.qq.com/index.php/core/account/api_cert) |
31 | | - protected static final String PARTNER_KEY = ""; |
| 22 | + @Value("#{wxProperties.appid}") |
| 23 | + private String appid; |
| 24 | + |
| 25 | + @Value("#{wxProperties.appsecret}") |
| 26 | + private String appsecret; |
| 27 | + |
| 28 | + @Value("#{wxProperties.token}") |
| 29 | + private String token; |
| 30 | + |
| 31 | + @Value("#{wxProperties.aeskey}") |
| 32 | + private String aesKey; |
| 33 | + |
| 34 | + @Value("#{wxProperties.partener_id}") |
| 35 | + private String partenerId; |
| 36 | + |
| 37 | + @Value("#{wxProperties.partener_key}") |
| 38 | + private String partenerKey; |
32 | 39 |
|
33 | 40 | @Bean |
34 | 41 | public WxMpConfigStorage wxMpConfigStorage() { |
35 | 42 | WxMpInMemoryConfigStorage configStorage = new WxMpInMemoryConfigStorage(); |
36 | | - configStorage.setAppId(MainConfig.APP_ID); |
37 | | - configStorage.setSecret(MainConfig.APP_SECRET); |
38 | | - configStorage.setToken(MainConfig.TOKEN); |
39 | | - configStorage.setAesKey(MainConfig.AES_KEY); |
40 | | - configStorage.setPartnerId(MainConfig.PARTNER_ID); |
41 | | - configStorage.setPartnerKey(MainConfig.PARTNER_KEY); |
| 43 | + configStorage.setAppId(this.appid); |
| 44 | + configStorage.setSecret(this.appsecret); |
| 45 | + configStorage.setToken(this.token); |
| 46 | + configStorage.setAesKey(this.aesKey); |
| 47 | + configStorage.setPartnerId(this.partenerId); |
| 48 | + configStorage.setPartnerKey(this.partenerKey); |
42 | 49 | return configStorage; |
43 | 50 | } |
44 | 51 |
|
|
0 commit comments