aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/MainModule.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/traccar/MainModule.java')
-rw-r--r--src/main/java/org/traccar/MainModule.java17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/main/java/org/traccar/MainModule.java b/src/main/java/org/traccar/MainModule.java
index 950a7278a..b7bdbc6bf 100644
--- a/src/main/java/org/traccar/MainModule.java
+++ b/src/main/java/org/traccar/MainModule.java
@@ -341,14 +341,17 @@ public class MainModule extends AbstractModule {
@Provides
public static BroadcastService provideBroadcastService(
Config config, ObjectMapper objectMapper) throws IOException {
- switch (config.getString(Keys.BROADCAST_TYPE)) {
- case "multicast":
- return new MulticastBroadcastService(config, objectMapper);
- case "redis":
- return new RedisBroadcastService(config, objectMapper);
- default:
- return new NullBroadcastService();
+ if (config.hasKey(Keys.BROADCAST_TYPE)) {
+ switch (config.getString(Keys.BROADCAST_TYPE)) {
+ case "multicast":
+ return new MulticastBroadcastService(config, objectMapper);
+ case "redis":
+ return new RedisBroadcastService(config, objectMapper);
+ default:
+ break;
+ }
}
+ return new NullBroadcastService();
}
@Singleton