wechatpay-apiv3 / wechatpay-java

微信支付 APIv3 的官方 Java Library
Apache License 2.0
959 stars 209 forks source link

将pem文件放到resources下,RSAAutoCertificateConfig无法读取到配置文件 #252

Open Astrsea opened 8 months ago

Astrsea commented 8 months ago

错误描述

将pem文件放到resources下,RSAAutoCertificateConfig无法读取到配置文件

重现bug的步骤

1.将pem文件放在resources下

屏幕截图 2024-01-19 124654

2.springboot.yml配置pem文件的路径

2

3.创建配置文件的实体类对象

3

4.RSAAutoCertificateConfig中传入配置对象

4

预期行为

不论是否在配置是否为private-key-path: apiclient_key.pem或者private-key-path: classpath:apiclient_key.pem,打包成jar包后,在linux环境运行时都会出现无法读取到pem文件的问题

导致错误的代码片段

return new RSAAutoCertificateConfig.Builder() .merchantId(wxProperty.getMchId()) .privateKeyFromPath(wxProperty.getPrivateKeyPath()) .merchantSerialNumber(wxProperty.getMchSerialNo()) .apiV3Key(wxProperty.getApiV3Key()) .build();

操作系统

Linux

Java 版本

java 17

wechatpay-java 版本

0.2.12

其他信息

No response

Proito666 commented 5 months ago

198