Bladeren bron

循环依赖

wks 3 jaren geleden
bovenliggende
commit
35998a0e75

+ 9 - 12
src/main/java/com/ydtech/modules/protocol/service/impl/PtlAgreementServiceImpl.java

@@ -24,7 +24,7 @@ import com.ydtech.modules.protocol.utils.AssertionUtils;
 import org.apache.commons.lang3.ObjectUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.BeanUtils;
-import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -53,30 +53,27 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
 
     private final EsmInsCompanyService esmInsCompanyService;
 
-    private InsCrawlerOrderService insCrawlerOrderController;
+    private final InsCrawlerOrderService insCrawlerOrderController;
+
+    private final PtlAgreementService proxyObject;
 
-    private PtlAgreementService proxyObject;
 
     private final PtlAgreementNonCarProductCostsService ptlAgreementNonCarProductCostsService;
 
-    public PtlAgreementServiceImpl(PtlAgreementProductCostsService ptlAgreementProductCostsService, PtlAgreementUnderwritingRulesService ptlAgreementUnderwritingRulesService, PtlAgreementAttributionService ptlAgreementAttributionService, PtlAgreementDeptService ptlAgreementDeptService, EsmInsCompanyService esmInsCompanyService, PtlAgreementNonCarProductCostsService ptlAgreementNonCarProductCostsService) {
+    public PtlAgreementServiceImpl(PtlAgreementProductCostsService ptlAgreementProductCostsService, PtlAgreementUnderwritingRulesService ptlAgreementUnderwritingRulesService,
+                                   PtlAgreementAttributionService ptlAgreementAttributionService, PtlAgreementDeptService ptlAgreementDeptService,
+                                   EsmInsCompanyService esmInsCompanyService, PtlAgreementNonCarProductCostsService ptlAgreementNonCarProductCostsService,
+                                   @Lazy InsCrawlerOrderService insCrawlerOrderController, @Lazy PtlAgreementService proxyObject) {
         this.ptlAgreementProductCostsService = ptlAgreementProductCostsService;
         this.ptlAgreementUnderwritingRulesService = ptlAgreementUnderwritingRulesService;
         this.ptlAgreementAttributionService = ptlAgreementAttributionService;
         this.ptlAgreementDeptService = ptlAgreementDeptService;
         this.esmInsCompanyService = esmInsCompanyService;
         this.ptlAgreementNonCarProductCostsService = ptlAgreementNonCarProductCostsService;
-    }
-
-    @Autowired
-    public void setProxyObject(PtlAgreementService proxyObject) {
+        this.insCrawlerOrderController = insCrawlerOrderController;
         this.proxyObject = proxyObject;
     }
 
-    @Autowired
-    public void setInsCrawlerOrderController(InsCrawlerOrderService insCrawlerOrderController) {
-        this.insCrawlerOrderController = insCrawlerOrderController;
-    }
 
     @Override
     public List<PtlAgreementInsCompanyDto> getAgreementCompany(String deptId) {

+ 6 - 7
src/main/java/com/ydtech/modules/protocol/service/impl/PtlInsAttributionTemplateServiceImpl.java

@@ -22,6 +22,7 @@ import com.ydtech.modules.protocol.utils.AssertionUtils;
 import com.ydtech.utils.StringUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.ObjectUtils;
@@ -42,17 +43,15 @@ public class PtlInsAttributionTemplateServiceImpl extends ServiceImpl<PtlInsAttr
 
     private final PtlCrawlerApiService ptlCrawlerApiService;
 
-    public PtlInsAttributionTemplateServiceImpl(EsmInsCompanyService esmInsCompanyService, PtlCrawlerApiService ptlCrawlerApiService) {
+    private final PtlInsAttributionTemplateService proxyService;
+
+    public PtlInsAttributionTemplateServiceImpl(EsmInsCompanyService esmInsCompanyService, PtlCrawlerApiService ptlCrawlerApiService,
+                                                @Lazy PtlInsAttributionTemplateService proxyService) {
         this.esmInsCompanyService = esmInsCompanyService;
         this.ptlCrawlerApiService = ptlCrawlerApiService;
+        this.proxyService = proxyService;
     }
 
-    private PtlInsAttributionTemplateService proxyService;
-
-    @Autowired
-    public void setPtlInsAttributionTemplateService(PtlInsAttributionTemplateService ptlInsAttributionTemplateService) {
-        this.proxyService = ptlInsAttributionTemplateService;
-    }
 
     @Override
     public PtlInsAttributionTemplate getByApiTypeAndInsCompanyId(PtlInsAttributionTemplateSaveVo ptlInsAttributionTemplateSaveVo) {