From 997f0047084695424d7b14f0002197c668689825 Mon Sep 17 00:00:00 2001 From: Fang Date: Mon, 6 Mar 2023 22:31:55 +0800 Subject: [PATCH] =?UTF-8?q?enhance:=20=E5=A2=9E=E5=BC=BA=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E5=8A=A0=E8=BD=BD=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../felord/payment/wechat/InMemoryWechatTenantService.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/InMemoryWechatTenantService.java b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/InMemoryWechatTenantService.java index e4ba13e..e35272b 100644 --- a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/InMemoryWechatTenantService.java +++ b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/InMemoryWechatTenantService.java @@ -23,6 +23,7 @@ import lombok.AllArgsConstructor; import org.springframework.core.io.FileSystemResource; import org.springframework.core.io.Resource; import org.springframework.core.io.ResourceLoader; +import org.springframework.util.ResourceUtils; import java.util.Map; import java.util.Set; @@ -38,6 +39,7 @@ import java.util.stream.Collectors; public class InMemoryWechatTenantService implements WechatTenantService { private final WechatPayProperties wechatPayProperties; private final ResourceLoader resourceLoader; + @Override public Set loadTenants() { Map v3Map = wechatPayProperties.getV3(); @@ -51,7 +53,8 @@ public class InMemoryWechatTenantService implements WechatTenantService { String certAbsolutePath = v3.getCertAbsolutePath(); String mchId = v3.getMchId(); Resource resource = certAbsolutePath != null ? new FileSystemResource(certAbsolutePath) : - resourceLoader.getResource(certPath == null ? "wechat/apiclient_cert.p12" : certPath); + resourceLoader.getResource(certPath == null ? "classpath:wechat/apiclient_cert.p12" : + certPath.startsWith(ResourceUtils.CLASSPATH_URL_PREFIX) ? certPath : ResourceUtils.CLASSPATH_URL_PREFIX + certPath); WechatMetaBean wechatMetaBean = keyPairFactory.initWechatMetaBean(resource, mchId); wechatMetaBean.setV3(v3); wechatMetaBean.setTenantId(tenantId);