|
@@ -1,10 +1,12 @@
|
1
|
1
|
package com.xxl.job.admin.core.conf;
|
2
|
2
|
|
|
3
|
+import com.xxl.job.admin.core.scheduler.XxlJobScheduler;
|
3
|
4
|
import com.xxl.job.admin.dao.XxlJobGroupDao;
|
4
|
5
|
import com.xxl.job.admin.dao.XxlJobInfoDao;
|
5
|
6
|
import com.xxl.job.admin.dao.XxlJobLogDao;
|
6
|
7
|
import com.xxl.job.admin.dao.XxlJobRegistryDao;
|
7
|
8
|
import com.xxl.job.core.biz.AdminBiz;
|
|
9
|
+import org.springframework.beans.factory.DisposableBean;
|
8
|
10
|
import org.springframework.beans.factory.InitializingBean;
|
9
|
11
|
import org.springframework.beans.factory.annotation.Value;
|
10
|
12
|
import org.springframework.mail.javamail.JavaMailSender;
|
|
@@ -19,16 +21,35 @@ import javax.sql.DataSource;
|
19
|
21
|
* @author xuxueli 2017-04-28
|
20
|
22
|
*/
|
21
|
23
|
|
22
|
|
-public class XxlJobAdminConfig {
|
|
24
|
+@Component
|
|
25
|
+public class XxlJobAdminConfig implements InitializingBean, DisposableBean {
|
|
26
|
+
|
23
|
27
|
private static XxlJobAdminConfig adminConfig = null;
|
24
|
28
|
public static XxlJobAdminConfig getAdminConfig() {
|
25
|
29
|
return adminConfig;
|
26
|
30
|
}
|
27
|
31
|
|
28
|
|
- public static void setAdminConfig(XxlJobAdminConfig config) {
|
29
|
|
- XxlJobAdminConfig.adminConfig = config;
|
|
32
|
+
|
|
33
|
+ // ---------------------- XxlJobScheduler ----------------------
|
|
34
|
+
|
|
35
|
+ private XxlJobScheduler xxlJobScheduler;
|
|
36
|
+
|
|
37
|
+ @Override
|
|
38
|
+ public void afterPropertiesSet() throws Exception {
|
|
39
|
+ adminConfig = this;
|
|
40
|
+
|
|
41
|
+ xxlJobScheduler = new XxlJobScheduler();
|
|
42
|
+ xxlJobScheduler.init();
|
30
|
43
|
}
|
31
|
44
|
|
|
45
|
+ @Override
|
|
46
|
+ public void destroy() throws Exception {
|
|
47
|
+ xxlJobScheduler.destroy();
|
|
48
|
+ }
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+ // ---------------------- XxlJobScheduler ----------------------
|
|
52
|
+
|
32
|
53
|
// conf
|
33
|
54
|
@Value("${xxl.job.i18n}")
|
34
|
55
|
private String i18n;
|