【resource】设置resource监听器的顺序

pull/3/head
fengshuonan 2020-12-20 18:09:32 +08:00
parent 43cd3574c1
commit fa93ce97b1
2 changed files with 13 additions and 1 deletions

View File

@ -23,4 +23,9 @@ public interface ScannerConstants {
*/
String RESOURCE_CACHE_KEY = "GUNS_RESOURCE_CACHES";
/**
*
*/
Integer REPORT_RESOURCE_LISTENER_SORT = 200;
}

View File

@ -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<ApplicationReadyEvent> {
public class ResourceReportListener implements ApplicationListener<ApplicationReadyEvent>, Ordered {
@Override
public void onApplicationEvent(ApplicationReadyEvent event) {
@ -55,4 +57,9 @@ public class ResourceReportListener implements ApplicationListener<ApplicationRe
}
@Override
public int getOrder() {
return ScannerConstants.REPORT_RESOURCE_LISTENER_SORT;
}
}