WechatPayConfig.java 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. package com.kyl.config;
  2. import com.kyl.client.Config;
  3. import org.springframework.beans.factory.annotation.Autowired;
  4. import org.springframework.boot.context.properties.EnableConfigurationProperties;
  5. import org.springframework.context.annotation.Configuration;
  6. /**
  7. * @ClassName WeChatPayConfig.java
  8. * 微信配置类
  9. */
  10. @Configuration
  11. @EnableConfigurationProperties(WechatPayProperties.class)
  12. public class WechatPayConfig {
  13. @Autowired
  14. WechatPayProperties wechatPayProperties;
  15. /***
  16. * 获得配置
  17. * @return
  18. */
  19. public Config config(){
  20. return Config.builder()
  21. .appid(wechatPayProperties.getAppid())
  22. .domain(wechatPayProperties.getDomain())
  23. .mchId(wechatPayProperties.getMchId())
  24. .mchSerialNo(wechatPayProperties.getMchSerialNo())
  25. .apiV3Key(wechatPayProperties.getApiV3Key())
  26. .privateKey(wechatPayProperties.getPrivateKey())
  27. .notifyUrl(wechatPayProperties.getNotifyUrl())
  28. .build();
  29. }
  30. }