Merge pull request #1181 from j112929/master

修复服务器报错无法创建bean  XxlJobAdminConfig
master
许雪里 5 years ago committed by GitHub
commit 0b9153f136
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 27
      xxl-job-admin/src/main/java/com/xxl/job/admin/core/conf/XxlJobAdminBean
  2. 9
      xxl-job-admin/src/main/java/com/xxl/job/admin/core/conf/XxlJobAdminConfig.java
  3. 11
      xxl-job-admin/src/main/java/com/xxl/job/admin/core/conf/XxlJobScheduler.java

@ -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();
}
}

@ -18,16 +18,15 @@ import javax.sql.DataSource;
* *
* @author xuxueli 2017-04-28 * @author xuxueli 2017-04-28
*/ */
@Component
public class XxlJobAdminConfig implements InitializingBean{ public class XxlJobAdminConfig {
private static XxlJobAdminConfig adminConfig = null; private static XxlJobAdminConfig adminConfig = null;
public static XxlJobAdminConfig getAdminConfig() { public static XxlJobAdminConfig getAdminConfig() {
return adminConfig; return adminConfig;
} }
@Override public static void setAdminConfig(XxlJobAdminConfig config) {
public void afterPropertiesSet() throws Exception { XxlJobAdminConfig.adminConfig = config;
adminConfig = this;
} }
// conf // conf

@ -33,14 +33,13 @@ import java.util.concurrent.ConcurrentMap;
/** /**
* @author xuxueli 2018-10-28 00:18:17 * @author xuxueli 2018-10-28 00:18:17
*/ */
@Component
@DependsOn("xxlJobAdminConfig") public class XxlJobScheduler {
public class XxlJobScheduler implements InitializingBean, DisposableBean {
private static final Logger logger = LoggerFactory.getLogger(XxlJobScheduler.class); private static final Logger logger = LoggerFactory.getLogger(XxlJobScheduler.class);
@Override
public void afterPropertiesSet() throws Exception { public void init() throws Exception {
// init i18n // init i18n
initI18n(); initI18n();
@ -59,7 +58,7 @@ public class XxlJobScheduler implements InitializingBean, DisposableBean {
logger.info(">>>>>>>>> init xxl-job admin success."); logger.info(">>>>>>>>> init xxl-job admin success.");
} }
@Override
public void destroy() throws Exception { public void destroy() throws Exception {
// stop-schedule // stop-schedule

Loading…
Cancel
Save