提交 27c37170 作者: xiaowang

修复:文件找不到问题

上级 fa881ba7
...@@ -7,6 +7,8 @@ import com.wechat.pay.java.core.notification.NotificationConfig; ...@@ -7,6 +7,8 @@ import com.wechat.pay.java.core.notification.NotificationConfig;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.io.File;
import java.net.URL;
/** /**
* @Author LW * @Author LW
...@@ -47,8 +49,8 @@ public class WxConfigUtils { ...@@ -47,8 +49,8 @@ public class WxConfigUtils {
} }
private String getFilePath() { private String getFilePath() {
String path = this.getClass().getClassLoader().getResource("").getPath(); ClassLoader classLoader = getClass().getClassLoader();
String privateKeyPath = path + "apiclient_key.pem"; URL resourceUrl = classLoader.getResource("apiclient_key.pem");
return privateKeyPath; return new File(resourceUrl.getFile()).getAbsolutePath();
} }
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论