From fa93ce97b174d6a630f1a8b0013731b8e9df8c12 Mon Sep 17 00:00:00 2001 From: fengshuonan Date: Sun, 20 Dec 2020 18:09:32 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90resource=E3=80=91=E8=AE=BE=E7=BD=AEres?= =?UTF-8?q?ource=E7=9B=91=E5=90=AC=E5=99=A8=E7=9A=84=E9=A1=BA=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kernel/resource/api/constants/ScannerConstants.java | 5 +++++ .../kernel/resource/scanner/ResourceReportListener.java | 9 ++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) 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