diff --git a/kernel-d-scanner/scanner-api/src/main/java/cn/stylefeng/roses/kernel/resource/api/constants/ScannerConstants.java b/kernel-d-scanner/scanner-api/src/main/java/cn/stylefeng/roses/kernel/resource/api/constants/ScannerConstants.java index 65adc99fe..305c5357a 100644 --- a/kernel-d-scanner/scanner-api/src/main/java/cn/stylefeng/roses/kernel/resource/api/constants/ScannerConstants.java +++ b/kernel-d-scanner/scanner-api/src/main/java/cn/stylefeng/roses/kernel/resource/api/constants/ScannerConstants.java @@ -23,4 +23,9 @@ public interface ScannerConstants { */ String RESOURCE_CACHE_KEY = "GUNS_RESOURCE_CACHES"; + /** + * 资源汇报的监听器的顺序 + */ + Integer REPORT_RESOURCE_LISTENER_SORT = 200; + } diff --git a/kernel-d-scanner/scanner-sdk-scanner/src/main/java/cn/stylefeng/roses/kernel/resource/scanner/ResourceReportListener.java b/kernel-d-scanner/scanner-sdk-scanner/src/main/java/cn/stylefeng/roses/kernel/resource/scanner/ResourceReportListener.java index 4991a6ca8..593054755 100644 --- a/kernel-d-scanner/scanner-sdk-scanner/src/main/java/cn/stylefeng/roses/kernel/resource/scanner/ResourceReportListener.java +++ b/kernel-d-scanner/scanner-sdk-scanner/src/main/java/cn/stylefeng/roses/kernel/resource/scanner/ResourceReportListener.java @@ -2,6 +2,7 @@ package cn.stylefeng.roses.kernel.resource.scanner; import cn.stylefeng.roses.kernel.resource.api.ResourceCollectorApi; import cn.stylefeng.roses.kernel.resource.api.ResourceReportApi; +import cn.stylefeng.roses.kernel.resource.api.constants.ScannerConstants; import cn.stylefeng.roses.kernel.resource.api.holder.InitScanFlagHolder; import cn.stylefeng.roses.kernel.resource.api.pojo.resource.ReportResourceParam; import cn.stylefeng.roses.kernel.resource.api.pojo.resource.ResourceDefinition; @@ -11,6 +12,7 @@ import org.springframework.boot.context.event.ApplicationReadyEvent; import org.springframework.context.ApplicationListener; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.annotation.AnnotationConfigApplicationContext; +import org.springframework.core.Ordered; import java.util.Map; @@ -21,7 +23,7 @@ import java.util.Map; * @date 2020/10/19 22:27 */ @Slf4j -public class ResourceReportListener implements ApplicationListener { +public class ResourceReportListener implements ApplicationListener, Ordered { @Override public void onApplicationEvent(ApplicationReadyEvent event) { @@ -55,4 +57,9 @@ public class ResourceReportListener implements ApplicationListener