赞
踩
pom依赖:
- <dependency>
- <groupId>com.github.binarywang</groupId>
- <artifactId>weixin-java-pay</artifactId>
- <version>3.6.0</version>
- <exclusions>
- <exclusion>
- <groupId>com.github.binarywang</groupId>
- <artifactId>qrcode-utils</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
application.yml配置:
- wx:
- app-id:
- app-secret:
- mch-id:
- mch-key:
- notify-url:
- refund-notify-url: # 微信退款通知回调接口
- key-path: classpath:cert/apiclient_cert.p12
读取配置信息,初始化配置,两个文件:
- @Configuration
- @ConfigurationProperties(prefix = "wx")
- @Data
- public class WxProperties {
-
- private String appId;
-
- private String mchId;
-
- private String mchKey;
-
- private String notifyUrl;
-
- private String keyPath;
-
- private String refundNotifyUrl;
-
- }
![](https://csdnimg.cn/release/blogv2/dist/pc/img/newCodeMoreWhite.png)
- @Configuration
- public class WxConfig {
-
- private final WxProperties properties;
-
- public WxConfig(WxProperties properties) {
- this.properties =
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。