Эх сурвалжийг харах

fix(circular-dep): PaymentService添加@Lazy解决循环依赖

@Lazy延迟初始化ProductOrderService,打破
AdminController → ProductOrderService → PaymentService 循环
User 2 сар өмнө
parent
commit
4d7319c8e2

+ 2 - 0
cfc-backend/src/main/java/com/etotem/cfc/service/PaymentService.java

@@ -15,6 +15,7 @@ import okhttp3.Response;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.PostConstruct;
@@ -53,6 +54,7 @@ public class PaymentService implements PaymentServiceInterface {
     @Resource
     private CommissionService commissionService;
 
+    @Lazy
     @Resource
     private ProductOrderService productOrderService;