diff --git a/core/src/main/java/org/elasticsearch/client/transport/TransportClient.java b/core/src/main/java/org/elasticsearch/client/transport/TransportClient.java index 7f7820620f4..9cdbef39cc0 100644 --- a/core/src/main/java/org/elasticsearch/client/transport/TransportClient.java +++ b/core/src/main/java/org/elasticsearch/client/transport/TransportClient.java @@ -141,7 +141,7 @@ public class TransportClient extends AbstractClient { ModulesBuilder modules = new ModulesBuilder(); // plugin modules must be added here, before others or we can get crazy injection errors... - for (Module pluginModule : pluginsService.nodeModules()) { + for (Module pluginModule : pluginsService.createGuiceModules()) { modules.add(pluginModule); } modules.add(new NetworkModule(networkService, settings, true, namedWriteableRegistry)); diff --git a/core/src/main/java/org/elasticsearch/node/Node.java b/core/src/main/java/org/elasticsearch/node/Node.java index ac970d7d333..454a49291d8 100644 --- a/core/src/main/java/org/elasticsearch/node/Node.java +++ b/core/src/main/java/org/elasticsearch/node/Node.java @@ -134,7 +134,6 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.function.Function; import java.util.stream.Collectors; -import java.util.stream.Stream; /** * A node represent a node within a cluster (cluster.name). The {@link #client()} can be used @@ -280,7 +279,7 @@ public class Node implements Closeable { ModulesBuilder modules = new ModulesBuilder(); // plugin modules must be added here, before others or we can get crazy injection errors... - for (Module pluginModule : pluginsService.nodeModules()) { + for (Module pluginModule : pluginsService.createGuiceModules()) { modules.add(pluginModule); } final MonitorService monitorService = new MonitorService(settings, nodeEnvironment, threadPool); diff --git a/core/src/main/java/org/elasticsearch/plugins/PluginsService.java b/core/src/main/java/org/elasticsearch/plugins/PluginsService.java index 377e77df703..a03b7c30b7f 100644 --- a/core/src/main/java/org/elasticsearch/plugins/PluginsService.java +++ b/core/src/main/java/org/elasticsearch/plugins/PluginsService.java @@ -268,16 +268,10 @@ public class PluginsService extends AbstractComponent { return builder.put(this.settings).build(); } - @SuppressWarnings("unchecked") - public Collection nodeModules() { + public Collection createGuiceModules() { List modules = new ArrayList<>(); for (Tuple plugin : plugins) { modules.addAll(plugin.v2().createGuiceModules()); - modules.add(b -> { - for (Object c : plugin.v2().createComponents()) { - b.bind((Class)c.getClass()).toInstance(c); - } - }); } return modules; } diff --git a/test/framework/src/main/java/org/elasticsearch/test/AbstractQueryTestCase.java b/test/framework/src/main/java/org/elasticsearch/test/AbstractQueryTestCase.java index ed0ae4c1fbb..81f6b78c037 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/AbstractQueryTestCase.java +++ b/test/framework/src/main/java/org/elasticsearch/test/AbstractQueryTestCase.java @@ -874,7 +874,7 @@ public abstract class AbstractQueryTestCase> } }; ModulesBuilder modulesBuilder = new ModulesBuilder(); - for (Module pluginModule : pluginsService.nodeModules()) { + for (Module pluginModule : pluginsService.createGuiceModules()) { modulesBuilder.add(pluginModule); } modulesBuilder.add(