diff --git a/escheduler-alert/src/main/java/cn/escheduler/alert/AlertServer.java b/escheduler-alert/src/main/java/cn/escheduler/alert/AlertServer.java index b8402aacf1..8d27f6f770 100644 --- a/escheduler-alert/src/main/java/cn/escheduler/alert/AlertServer.java +++ b/escheduler-alert/src/main/java/cn/escheduler/alert/AlertServer.java @@ -39,22 +39,21 @@ public class AlertServer implements CommandLineRunner { /** * Alert Dao */ - @Autowired private AlertDao alertDao; private AlertSender alertSender; private static volatile AlertServer instance; - public AlertServer() { - + public AlertServer(AlertDao alertDao) { + this.alertDao = alertDao; } - public static AlertServer getInstance(){ + public static AlertServer getInstance(AlertDao alertDao){ if (null == instance) { synchronized (AlertServer.class) { if(null == instance) { - instance = new AlertServer(); + instance = new AlertServer(alertDao); } } } @@ -83,7 +82,7 @@ public class AlertServer implements CommandLineRunner { @Override public void run(String... strings) throws Exception { - AlertServer alertServer = AlertServer.getInstance(); + AlertServer alertServer = AlertServer.getInstance(alertDao); alertServer.start(); } } diff --git a/escheduler-api/src/main/java/cn/escheduler/api/CombinedApplicationServer.java b/escheduler-api/src/main/java/cn/escheduler/api/CombinedApplicationServer.java index fc421944e9..70535488aa 100644 --- a/escheduler-api/src/main/java/cn/escheduler/api/CombinedApplicationServer.java +++ b/escheduler-api/src/main/java/cn/escheduler/api/CombinedApplicationServer.java @@ -51,7 +51,7 @@ public class CombinedApplicationServer extends SpringBootServletInitializer { LoggerServer server = new LoggerServer(); server.start(); - AlertServer alertServer = AlertServer.getInstance(); + AlertServer alertServer = AlertServer.getInstance(alertDao); alertServer.start(); } }