wechatpay-apiv3 / wechatpay-apache-httpclient

微信支付 APIv3 Apache HttpClient装饰器(decorator)
https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pages/index.shtml
Apache License 2.0
665 stars 249 forks source link

使用时Verifier没有办法初始化在springboot中 #190

Closed autumn11 closed 9 months ago

autumn11 commented 1 year ago

在springboot项目中,初始化Verifier会报错 @Resource private Verifier verifier; 报错信息: Action:

Consider defining a bean of type 'com.wechat.pay.contrib.apache.httpclient.auth.Verifier' in your configuration.

pigeon-fancier commented 11 months ago

因为不支持无参构造吧 `public class CertificatesVerifier implements Verifier {

private static final Logger log = LoggerFactory.getLogger(CertificatesVerifier.class);
protected final HashMap<BigInteger, X509Certificate> certificates = new HashMap<>();

public CertificatesVerifier(List<X509Certificate> list) {
    for (X509Certificate item : list) {
        certificates.put(item.getSerialNumber(), item);
    }
}

public CertificatesVerifier(Map<BigInteger, X509Certificate> certificates) {
    this.certificates.putAll(certificates);
}`
这里的两个构造都是要传入值的
ChaoFengZhu commented 7 months ago

怎么解决了