From 80333db80ef083c7b83853bd4672abbcacaeb4b9 Mon Sep 17 00:00:00 2001 From: jzl Date: Mon, 14 Oct 2019 09:43:32 +0800 Subject: [PATCH 1/3] Create XxlJobAdminBean --- .../xxl/job/admin/core/conf/XxlJobAdminBean | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 xxl-job-admin/src/main/java/com/xxl/job/admin/core/conf/XxlJobAdminBean diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/core/conf/XxlJobAdminBean b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/conf/XxlJobAdminBean new file mode 100644 index 00000000..32b78eae --- /dev/null +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/conf/XxlJobAdminBean @@ -0,0 +1,27 @@ +package com.xxl.job.admin.conf; + +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * @Auther: zhuolin.ji + * @Date: 2019/10/12 18:08 + * @Package: com.xxl.job.admin.conf + * @Description: + */ +@Configuration +public class XxlJobAdminBean { + + @Bean(name = "xxlJobAdminConfig") + public XxlJobAdminConfig getXxlJobAdminConfig() { + return new XxlJobAdminConfig(); + } + + @Bean(initMethod = "init", destroyMethod = "destroy") + public XxlJobScheduler getXxlJobScheduler(@Qualifier(value = "xxlJobAdminConfig") XxlJobAdminConfig xxlJobAdminConfig) { + XxlJobAdminConfig.setAdminConfig(xxlJobAdminConfig); + return new XxlJobScheduler(); + } + +} From 76b2316e17bf4fb3cc324722e7cba0487a8f5cb9 Mon Sep 17 00:00:00 2001 From: jzl Date: Mon, 14 Oct 2019 09:44:37 +0800 Subject: [PATCH 2/3] Update XxlJobAdminConfig.java --- .../com/xxl/job/admin/core/conf/XxlJobAdminConfig.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/core/conf/XxlJobAdminConfig.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/conf/XxlJobAdminConfig.java index 1e348a32..8eb91da6 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/admin/core/conf/XxlJobAdminConfig.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/conf/XxlJobAdminConfig.java @@ -18,16 +18,15 @@ import javax.sql.DataSource; * * @author xuxueli 2017-04-28 */ -@Component -public class XxlJobAdminConfig implements InitializingBean{ + +public class XxlJobAdminConfig { private static XxlJobAdminConfig adminConfig = null; public static XxlJobAdminConfig getAdminConfig() { return adminConfig; } - @Override - public void afterPropertiesSet() throws Exception { - adminConfig = this; + public static void setAdminConfig(XxlJobAdminConfig config) { + XxlJobAdminConfig.adminConfig = config; } // conf From 49d7c97a2e4468ce5d4292e78eae6276e0e13315 Mon Sep 17 00:00:00 2001 From: jzl Date: Mon, 14 Oct 2019 09:46:08 +0800 Subject: [PATCH 3/3] Update XxlJobScheduler.java --- .../com/xxl/job/admin/core/conf/XxlJobScheduler.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/core/conf/XxlJobScheduler.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/conf/XxlJobScheduler.java index 8b51d51b..52deb23e 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/admin/core/conf/XxlJobScheduler.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/conf/XxlJobScheduler.java @@ -33,14 +33,13 @@ import java.util.concurrent.ConcurrentMap; /** * @author xuxueli 2018-10-28 00:18:17 */ -@Component -@DependsOn("xxlJobAdminConfig") -public class XxlJobScheduler implements InitializingBean, DisposableBean { + +public class XxlJobScheduler { private static final Logger logger = LoggerFactory.getLogger(XxlJobScheduler.class); - @Override - public void afterPropertiesSet() throws Exception { + + public void init() throws Exception { // init i18n initI18n(); @@ -59,7 +58,7 @@ public class XxlJobScheduler implements InitializingBean, DisposableBean { logger.info(">>>>>>>>> init xxl-job admin success."); } - @Override + public void destroy() throws Exception { // stop-schedule