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