diff --git a/indexing-hadoop/src/main/java/io/druid/indexer/HadoopDruidIndexerConfig.java b/indexing-hadoop/src/main/java/io/druid/indexer/HadoopDruidIndexerConfig.java index bd245e4f3e6..d86ba7b7115 100644 --- a/indexing-hadoop/src/main/java/io/druid/indexer/HadoopDruidIndexerConfig.java +++ b/indexing-hadoop/src/main/java/io/druid/indexer/HadoopDruidIndexerConfig.java @@ -92,7 +92,7 @@ public class HadoopDruidIndexerConfig static { injector = Initialization.makeInjectorWithModules( GuiceInjectors.makeStartupInjector(), - ImmutableList.of( + ImmutableList.of( new Module() { @Override diff --git a/processing/src/main/java/io/druid/guice/GuiceInjectors.java b/processing/src/main/java/io/druid/guice/GuiceInjectors.java index 9a3425c872f..ee527698b40 100644 --- a/processing/src/main/java/io/druid/guice/GuiceInjectors.java +++ b/processing/src/main/java/io/druid/guice/GuiceInjectors.java @@ -19,6 +19,7 @@ package io.druid.guice; +import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; import com.google.inject.Binder; import com.google.inject.Guice; @@ -27,15 +28,16 @@ import com.google.inject.Module; import io.druid.jackson.JacksonModule; import java.util.Arrays; +import java.util.Collection; import java.util.List; /** */ public class GuiceInjectors { - public static Injector makeStartupInjector() + public static Collection makeDefaultStartupModules() { - return Guice.createInjector( + return ImmutableList.of( new DruidGuiceExtensions(), new JacksonModule(), new PropertiesModule(Arrays.asList("common.runtime.properties", "runtime.properties")), @@ -52,29 +54,18 @@ public class GuiceInjectors ); } - public static Injector makeStartupInjectorWithModules(Iterable modules) + public static Injector makeStartupInjector() + { + return Guice.createInjector(makeDefaultStartupModules()); + } + + public static Injector makeStartupInjectorWithModules(Iterable modules) { List theModules = Lists.newArrayList(); - theModules.add(new DruidGuiceExtensions()); - theModules.add(new JacksonModule()); - theModules.add(new PropertiesModule(Arrays.asList("common.runtime.properties", "runtime.properties"))); - theModules.add(new ConfigModule()); - theModules.add( - new Module() - { - @Override - public void configure(Binder binder) - { - binder.bind(DruidSecondaryModule.class); - JsonConfigProvider.bind(binder, "druid.extensions", ExtensionsConfig.class); - } - } - ); + theModules.addAll(makeDefaultStartupModules()); for (Module theModule : modules) { theModules.add(theModule); } - - return Guice.createInjector(theModules); } } diff --git a/server/src/main/java/io/druid/initialization/Initialization.java b/server/src/main/java/io/druid/initialization/Initialization.java index 058a007701d..4f9597c376b 100644 --- a/server/src/main/java/io/druid/initialization/Initialization.java +++ b/server/src/main/java/io/druid/initialization/Initialization.java @@ -328,7 +328,7 @@ public class Initialization } } - public static Injector makeInjectorWithModules(final Injector baseInjector, Iterable modules) + public static Injector makeInjectorWithModules(final Injector baseInjector, Iterable modules) { final ModuleList defaultModules = new ModuleList(baseInjector); defaultModules.addModules( diff --git a/server/src/test/java/io/druid/initialization/InitializationTest.java b/server/src/test/java/io/druid/initialization/InitializationTest.java index 2dce7260796..bab33ba6c56 100644 --- a/server/src/test/java/io/druid/initialization/InitializationTest.java +++ b/server/src/test/java/io/druid/initialization/InitializationTest.java @@ -102,7 +102,7 @@ public class InitializationTest { Injector startupInjector = GuiceInjectors.makeStartupInjector(); Injector injector = Initialization.makeInjectorWithModules( - startupInjector, ImmutableList.of( + startupInjector, ImmutableList.of( new com.google.inject.Module() { @Override diff --git a/server/src/test/java/io/druid/server/initialization/JettyTest.java b/server/src/test/java/io/druid/server/initialization/JettyTest.java index 40b1d4b7c9e..5b99d2890dc 100644 --- a/server/src/test/java/io/druid/server/initialization/JettyTest.java +++ b/server/src/test/java/io/druid/server/initialization/JettyTest.java @@ -97,7 +97,7 @@ public class JettyTest { setProperties(); Injector injector = Initialization.makeInjectorWithModules( - GuiceInjectors.makeStartupInjector(), ImmutableList.of( + GuiceInjectors.makeStartupInjector(), ImmutableList.of( new Module() { @Override diff --git a/services/src/main/java/io/druid/cli/CliBridge.java b/services/src/main/java/io/druid/cli/CliBridge.java index 861150ba4a1..e4de56ed5cf 100644 --- a/services/src/main/java/io/druid/cli/CliBridge.java +++ b/services/src/main/java/io/druid/cli/CliBridge.java @@ -62,9 +62,9 @@ public class CliBridge extends ServerRunnable } @Override - protected List getModules() + protected List getModules() { - return ImmutableList.of( + return ImmutableList.of( new Module() { @Override diff --git a/services/src/main/java/io/druid/cli/CliBroker.java b/services/src/main/java/io/druid/cli/CliBroker.java index e5ac925da02..10f5f5529c9 100644 --- a/services/src/main/java/io/druid/cli/CliBroker.java +++ b/services/src/main/java/io/druid/cli/CliBroker.java @@ -72,9 +72,9 @@ public class CliBroker extends ServerRunnable } @Override - protected List getModules() + protected List getModules() { - return ImmutableList.of( + return ImmutableList.of( new Module() { @Override diff --git a/services/src/main/java/io/druid/cli/CliCoordinator.java b/services/src/main/java/io/druid/cli/CliCoordinator.java index 329348a101b..7fbe40ecee3 100644 --- a/services/src/main/java/io/druid/cli/CliCoordinator.java +++ b/services/src/main/java/io/druid/cli/CliCoordinator.java @@ -80,9 +80,9 @@ public class CliCoordinator extends ServerRunnable } @Override - protected List getModules() + protected List getModules() { - return ImmutableList.of( + return ImmutableList.of( new Module() { @Override diff --git a/services/src/main/java/io/druid/cli/CliHistorical.java b/services/src/main/java/io/druid/cli/CliHistorical.java index 79c28b24c54..5da1bfde6a2 100644 --- a/services/src/main/java/io/druid/cli/CliHistorical.java +++ b/services/src/main/java/io/druid/cli/CliHistorical.java @@ -62,9 +62,9 @@ public class CliHistorical extends ServerRunnable } @Override - protected List getModules() + protected List getModules() { - return ImmutableList.of( + return ImmutableList.of( new Module() { @Override diff --git a/services/src/main/java/io/druid/cli/CliInternalHadoopIndexer.java b/services/src/main/java/io/druid/cli/CliInternalHadoopIndexer.java index 9b310b35b08..56bf59e95c9 100644 --- a/services/src/main/java/io/druid/cli/CliInternalHadoopIndexer.java +++ b/services/src/main/java/io/druid/cli/CliInternalHadoopIndexer.java @@ -66,9 +66,9 @@ public class CliInternalHadoopIndexer extends GuiceRunnable } @Override - protected List getModules() + protected List getModules() { - return ImmutableList.of( + return ImmutableList.of( new Module() { @Override diff --git a/services/src/main/java/io/druid/cli/CliMiddleManager.java b/services/src/main/java/io/druid/cli/CliMiddleManager.java index 6999b262f7a..da4976052f3 100644 --- a/services/src/main/java/io/druid/cli/CliMiddleManager.java +++ b/services/src/main/java/io/druid/cli/CliMiddleManager.java @@ -67,9 +67,9 @@ public class CliMiddleManager extends ServerRunnable } @Override - protected List getModules() + protected List getModules() { - return ImmutableList.of( + return ImmutableList.of( new Module() { @Override diff --git a/services/src/main/java/io/druid/cli/CliOverlord.java b/services/src/main/java/io/druid/cli/CliOverlord.java index a5351dd8968..792fc4155b7 100644 --- a/services/src/main/java/io/druid/cli/CliOverlord.java +++ b/services/src/main/java/io/druid/cli/CliOverlord.java @@ -105,9 +105,9 @@ public class CliOverlord extends ServerRunnable } @Override - protected List getModules() + protected List getModules() { - return ImmutableList.of( + return ImmutableList.of( new Module() { @Override diff --git a/services/src/main/java/io/druid/cli/CliPeon.java b/services/src/main/java/io/druid/cli/CliPeon.java index 3ee81cede38..25632cdeb5d 100644 --- a/services/src/main/java/io/druid/cli/CliPeon.java +++ b/services/src/main/java/io/druid/cli/CliPeon.java @@ -101,9 +101,9 @@ public class CliPeon extends GuiceRunnable } @Override - protected List getModules() + protected List getModules() { - return ImmutableList.of( + return ImmutableList.of( new Module() { @Override diff --git a/services/src/main/java/io/druid/cli/CliRealtime.java b/services/src/main/java/io/druid/cli/CliRealtime.java index a34e3bd0eda..4ac4605edfb 100644 --- a/services/src/main/java/io/druid/cli/CliRealtime.java +++ b/services/src/main/java/io/druid/cli/CliRealtime.java @@ -45,9 +45,9 @@ public class CliRealtime extends ServerRunnable } @Override - protected List getModules() + protected List getModules() { - return ImmutableList.of( + return ImmutableList.of( new RealtimeModule(), new Module() { @Override diff --git a/services/src/main/java/io/druid/cli/CliRealtimeExample.java b/services/src/main/java/io/druid/cli/CliRealtimeExample.java index a9ce071f000..3f1b03d502a 100644 --- a/services/src/main/java/io/druid/cli/CliRealtimeExample.java +++ b/services/src/main/java/io/druid/cli/CliRealtimeExample.java @@ -55,9 +55,9 @@ public class CliRealtimeExample extends ServerRunnable } @Override - protected List getModules() + protected List getModules() { - return ImmutableList.of( + return ImmutableList.of( new RealtimeModule(), new Module() { diff --git a/services/src/main/java/io/druid/cli/CliRouter.java b/services/src/main/java/io/druid/cli/CliRouter.java index 550f94e7c47..c80900a59e2 100644 --- a/services/src/main/java/io/druid/cli/CliRouter.java +++ b/services/src/main/java/io/druid/cli/CliRouter.java @@ -64,9 +64,9 @@ public class CliRouter extends ServerRunnable } @Override - protected List getModules() + protected List getModules() { - return ImmutableList.of( + return ImmutableList.of( new JettyHttpClientModule("druid.router.http", Router.class), new Module() { diff --git a/services/src/main/java/io/druid/cli/CreateTables.java b/services/src/main/java/io/druid/cli/CreateTables.java index 1611559fc5e..f9385ca15f9 100644 --- a/services/src/main/java/io/druid/cli/CreateTables.java +++ b/services/src/main/java/io/druid/cli/CreateTables.java @@ -62,9 +62,9 @@ public class CreateTables extends GuiceRunnable } @Override - protected List getModules() + protected List getModules() { - return ImmutableList.of( + return ImmutableList.of( new Module() { @Override diff --git a/services/src/main/java/io/druid/cli/GuiceRunnable.java b/services/src/main/java/io/druid/cli/GuiceRunnable.java index 466104427ed..7f2394d1115 100644 --- a/services/src/main/java/io/druid/cli/GuiceRunnable.java +++ b/services/src/main/java/io/druid/cli/GuiceRunnable.java @@ -22,6 +22,7 @@ package io.druid.cli; import com.google.common.base.Throwables; import com.google.inject.Inject; import com.google.inject.Injector; +import com.google.inject.Module; import com.metamx.common.lifecycle.Lifecycle; import com.metamx.common.logger.Logger; import io.druid.initialization.Initialization; @@ -48,7 +49,7 @@ public abstract class GuiceRunnable implements Runnable this.baseInjector = injector; } - protected abstract List getModules(); + protected abstract List getModules(); public Injector makeInjector() {