wangming vor 1 Monat
Ursprung
Commit
196ba36cae

+ 4 - 12
yami-shop-wx/src/main/java/com/yami/shop/wx/config/WechatPayServiceConfig.java

@@ -3,7 +3,9 @@ package com.yami.shop.wx.config;
 import lombok.Data;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.context.properties.ConfigurationProperties;
 import org.springframework.context.annotation.Configuration;
+import org.springframework.stereotype.Component;
 
 /**
  * 微信-服务商
@@ -11,40 +13,30 @@ import org.springframework.context.annotation.Configuration;
  * @author kaur
  */
 @Data
-@Configuration
+@Component
+@ConfigurationProperties(prefix = "services")
 public class WechatPayServiceConfig {
 
-    @Value("${services.spAppId}")
     private String spAppId;
 
-    @Value("${services.spMchId}")
     private String spMchId;
 
-    @Value("${services.subAppId}")
     private String subAppId;
 
-    @Value("${services.subMchId}")
     private String subMchId;
 
-    @Value("${services.apiKey}")
     private String apiKey;
 
-    @Value("${services.apiV3Key}")
     private String apiV3Key;
 
-    @Value("${services.keyPemPath}")
     private String keyPemPath;
 
-    @Value("${services.serialNo}")
     private String serialNo;
 
-    @Value("${services.baseUrl}")
     private String baseUrl;
 
-    @Value("${services.notifyUrl}")
     private String notifyUrl;
 
-    @Value("${services.refundNotifyUrl}")
     private String refundNotifyUrl;
 
 }