1、maven项目的pom.xml中添加如下jar包:
<dependency>
<groupId>com.github.wxpay</groupId>
<artifactId>wxpay-sdk</artifactId>
<version>0.0.3</version>
</dependency>
2、编写WeWxConfig类:
package com.xx.wxpay;
import com.github.wxpay.sdk.WXPayConfig;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.io.InputStream;
/**
* 描述:微信支付配置信息
*
* @author ssl
* @create 2018/04/24 19:25
*/
@Component
public class WeWxConfig implements WXPayConfig {
@Value("${wechat.public.appid}")
private String appId;
@Value("${wechat.merchant}")
private String mchId;
@Value("${wechat.public.apikey}")
private String apiKey;
/**
* 公众账号ID:微信支付分配的公众账号ID(企业号corpid即为此ap