aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/MainModule.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-06-18 13:47:56 -0700
committerAnton Tananaev <anton@traccar.org>2022-06-18 13:47:56 -0700
commit4d59dd0973479bca3d51cf3bba6b0769a0d671c3 (patch)
treede4276f0b05490988199e4af0049ea4c774c959e /src/main/java/org/traccar/MainModule.java
parente65bfeab8dafb02c21b360b4970d5d94013f53f6 (diff)
downloadtrackermap-server-4d59dd0973479bca3d51cf3bba6b0769a0d671c3.tar.gz
trackermap-server-4d59dd0973479bca3d51cf3bba6b0769a0d671c3.tar.bz2
trackermap-server-4d59dd0973479bca3d51cf3bba6b0769a0d671c3.zip
Fix config injection
Diffstat (limited to 'src/main/java/org/traccar/MainModule.java')
-rw-r--r--src/main/java/org/traccar/MainModule.java16
1 files changed, 1 insertions, 15 deletions
diff --git a/src/main/java/org/traccar/MainModule.java b/src/main/java/org/traccar/MainModule.java
index 7dcc91f32..39d5a656a 100644
--- a/src/main/java/org/traccar/MainModule.java
+++ b/src/main/java/org/traccar/MainModule.java
@@ -22,7 +22,6 @@ import com.google.inject.AbstractModule;
import com.google.inject.Injector;
import com.google.inject.Provides;
import com.google.inject.Scopes;
-import com.google.inject.name.Named;
import com.google.inject.name.Names;
import io.netty.util.HashedWheelTimer;
import io.netty.util.Timer;
@@ -61,7 +60,6 @@ import org.traccar.geolocation.UnwiredGeolocationProvider;
import org.traccar.handler.GeocoderHandler;
import org.traccar.handler.GeolocationHandler;
import org.traccar.handler.SpeedLimitHandler;
-import org.traccar.helper.Log;
import org.traccar.helper.SanitizerModule;
import org.traccar.notification.EventForwarder;
import org.traccar.session.cache.CacheManager;
@@ -95,6 +93,7 @@ public class MainModule extends AbstractModule {
@Override
protected void configure() {
bindConstant().annotatedWith(Names.named("configFile")).to(configFile);
+ bind(Config.class).asEagerSingleton();
bind(Storage.class).to(DatabaseStorage.class);
bind(Timer.class).to(HashedWheelTimer.class).in(Scopes.SINGLETON);
}
@@ -111,19 +110,6 @@ public class MainModule extends AbstractModule {
return objectMapper;
}
- @Singleton
- @Provides
- public static Config provideConfig(@Named("configFile") String configFile) throws Exception {
- try {
- Config config = new Config(configFile);
- Log.setupLogger(config);
- return config;
- } catch (Exception e) {
- Log.setupDefaultLogger();
- throw e;
- }
- }
-
@Provides
public static Client provideClient() {
return ClientBuilder.newClient().register(