aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/ServerManager.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/traccar/ServerManager.java')
-rw-r--r--src/main/java/org/traccar/ServerManager.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/ServerManager.java b/src/main/java/org/traccar/ServerManager.java
index a6bb6888c..f4f6e1ba4 100644
--- a/src/main/java/org/traccar/ServerManager.java
+++ b/src/main/java/org/traccar/ServerManager.java
@@ -15,11 +15,13 @@
*/
package org.traccar;
+import com.google.inject.Injector;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.traccar.config.Keys;
import org.traccar.helper.ClassScanner;
+import javax.inject.Inject;
import javax.inject.Singleton;
import java.io.IOException;
import java.net.BindException;
@@ -38,10 +40,12 @@ public class ServerManager implements LifecycleObject {
private final List<TrackerConnector> connectorList = new LinkedList<>();
private final Map<String, BaseProtocol> protocolList = new ConcurrentHashMap<>();
- public ServerManager() throws IOException, URISyntaxException, ReflectiveOperationException {
+ @Inject
+ public ServerManager(Injector injector) throws IOException, URISyntaxException, ReflectiveOperationException {
for (Class<?> protocolClass : ClassScanner.findSubclasses(BaseProtocol.class, "org.traccar.protocol")) {
if (Context.getConfig().hasKey(Keys.PROTOCOL_PORT.withPrefix(BaseProtocol.nameFromClass(protocolClass)))) {
BaseProtocol protocol = (BaseProtocol) protocolClass.getDeclaredConstructor().newInstance();
+ injector.injectMembers(protocol);
connectorList.addAll(protocol.getConnectorList());
protocolList.put(protocol.getName(), protocol);
}