From 336d6c4353fd77ad268aaf5cfe9c0296edfb0201 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Thu, 9 Jun 2022 18:03:52 -0700 Subject: Remove more from context --- .../java/org/traccar/notification/NotificatorManager.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/main/java/org/traccar/notification') diff --git a/src/main/java/org/traccar/notification/NotificatorManager.java b/src/main/java/org/traccar/notification/NotificatorManager.java index 9705377b4..d6ebb2c4a 100644 --- a/src/main/java/org/traccar/notification/NotificatorManager.java +++ b/src/main/java/org/traccar/notification/NotificatorManager.java @@ -23,8 +23,8 @@ import java.util.Set; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.traccar.Context; import org.traccar.Main; +import org.traccar.config.Config; import org.traccar.config.Keys; import org.traccar.model.Typed; import org.traccar.notificators.NotificatorFirebase; @@ -37,7 +37,11 @@ import org.traccar.notificators.NotificatorWeb; import org.traccar.notificators.NotificatorTelegram; import org.traccar.notificators.NotificatorPushover; -public final class NotificatorManager { +import javax.inject.Inject; +import javax.inject.Singleton; + +@Singleton +public class NotificatorManager { private static final Logger LOGGER = LoggerFactory.getLogger(NotificatorManager.class); @@ -52,8 +56,9 @@ public final class NotificatorManager { private final Map notificators = new HashMap<>(); - public NotificatorManager() { - String types = Context.getConfig().getString(Keys.NOTIFICATOR_TYPES); + @Inject + public NotificatorManager(Config config) { + String types = config.getString(Keys.NOTIFICATOR_TYPES); if (types != null) { for (String type : types.split(",")) { var notificatorClass = NOTIFICATORS_ALL.get(type); -- cgit v1.2.3