package com; import com.peanut.modules.pay.weChatPay.config.WechatPayConfig; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import javax.annotation.Resource; import java.security.PrivateKey; @SpringBootTest public class VxApiTest { @Resource private WechatPayConfig wechatPayConfig; @Test public void textgetPrivateKey(){ //获取私钥路径 String keyPemPath = wechatPayConfig.getKeyPemPath(); //获取私钥 PrivateKey privateKey = wechatPayConfig.getPrivateKey(keyPemPath); //输出很长的字符串 如果有问题转json试试 System.out.println(privateKey); } @Test public void getWxPayConfig(){ String mchId =wechatPayConfig.getMchId(); System.out.println(mchId); } }