Skip to content

WxPayConfig#hashCode 检查 verifier 字段导致异常 #1864

Closed
@xJoeWoo

Description

@xJoeWoo

模块版本情况

  • WxJava 模块名: WxPayConfig
  • WxJava 版本号: 3.9.0

详细描述

WxPayConfig#hashCode 会检查 verifier 字段,调用 WxPayConfig#getVerifier 方法,在方法内会初始化 verifier,导致检查与 http client 相关的参数,即使这些参数在项目中用不到。

在将 WxPayConfig 注册为 Spring Boot 里的 Bean 时,会调用 hashCode ,导致整个 App 启动失败。

测试样例:

new WxPayConfig().hashCode();

异常:

WxPayException(customErrorMsg=请确保privateKeyPath已设置
, returnCode=null, returnMsg=null, resultCode=null, errCode=null, errCodeDes=null, xmlString=null)
	at com.github.binarywang.wxpay.config.WxPayConfig.initApiV3HttpClient(WxPayConfig.java:245)
	at com.github.binarywang.wxpay.config.WxPayConfig.getVerifier(WxPayConfig.java:193)
	at com.github.binarywang.wxpay.config.WxPayConfig.hashCode(WxPayConfig.java:31)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions