From 80bc6f2598ed3a3e8b732380ae2557fa54074ce7 Mon Sep 17 00:00:00 2001 From: sjm <1191068887@qq.com> Date: Fri, 11 Aug 2023 10:26:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-mall/src/main/java/com/cyl/config/WechatConfig.java | 1 + ruoyi-mall/src/main/java/com/cyl/h5/service/H5OrderService.java | 2 ++ ruoyi-mall/src/main/java/com/cyl/wechat/WechatPayService.java | 2 ++ 3 files changed, 5 insertions(+) diff --git a/ruoyi-mall/src/main/java/com/cyl/config/WechatConfig.java b/ruoyi-mall/src/main/java/com/cyl/config/WechatConfig.java index 882a827..8d9c54d 100644 --- a/ruoyi-mall/src/main/java/com/cyl/config/WechatConfig.java +++ b/ruoyi-mall/src/main/java/com/cyl/config/WechatConfig.java @@ -9,6 +9,7 @@ import org.springframework.context.annotation.DependsOn; @Configuration @DependsOn("WechatPayData") +@ConditionalOnProperty(prefix = "wechat", name = "enabled", havingValue = "true") public class WechatConfig { @Bean diff --git a/ruoyi-mall/src/main/java/com/cyl/h5/service/H5OrderService.java b/ruoyi-mall/src/main/java/com/cyl/h5/service/H5OrderService.java index 596ae77..aba9635 100644 --- a/ruoyi-mall/src/main/java/com/cyl/h5/service/H5OrderService.java +++ b/ruoyi-mall/src/main/java/com/cyl/h5/service/H5OrderService.java @@ -50,6 +50,7 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; import org.springframework.data.domain.PageImpl; import org.springframework.data.domain.Pageable; import org.springframework.http.ResponseEntity; @@ -96,6 +97,7 @@ public class H5OrderService { private OrderOperateHistoryService orderOperateHistoryService; @Autowired + @Lazy private WechatPayService wechatPayService; @Autowired diff --git a/ruoyi-mall/src/main/java/com/cyl/wechat/WechatPayService.java b/ruoyi-mall/src/main/java/com/cyl/wechat/WechatPayService.java index 9743fe8..027ecc3 100644 --- a/ruoyi-mall/src/main/java/com/cyl/wechat/WechatPayService.java +++ b/ruoyi-mall/src/main/java/com/cyl/wechat/WechatPayService.java @@ -8,11 +8,13 @@ import com.wechat.pay.java.service.payments.jsapi.model.PrepayResponse; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.stereotype.Service; @Service @Slf4j +@ConditionalOnProperty(prefix = "wechat", name = "enabled", havingValue = "true") public class WechatPayService { @Autowired