Move ReplicationQueue and associated bindings to ReplicationModule

During the refactoring in I8003ec6c827f the ReplicationQueue and its
associated bindings were moved to the ReplicationConfigModule for
allowing the users of the replication APIs to be able to have the
full bindings of all the internal replication plugin mechanisms.

However, the change was reverted in I461cd1bef because of the
breakages generated and later a new approch has been introduced
with I349461e29d where the APIs are exposed via DynamicItem<>
and the caller isn't required anymore to have the full Guice
bindings to re-create the replication objects.

As a result, the bindings of the replication plugin internals
remained in the ReplicationConfigModule with nasty consequences
of other plugins (e.g. pull-replication) to inadvertently generate
just-in-time bindings of the replication plugin classes.

When using the pull-replication and replication plugins together
the just-in-time bindings would then eventually conflict
with the explicit bindings done in the replication plugin.

Example:

[2024-06-27T22:23:19.471+01:00] [main] WARN  com.google.gerrit.server.plugins.PluginLoader : Cannot load plugin replication
com.google.inject.CreationException: Unable to create injector, see the following errors:

1) [Guice/JitBindingAlreadySet]: A just-in-time binding to DynamicSet<ReplicationStateListener> was already configured on a parent injector.
  at DynamicSet.setOf(DynamicSet.java:88)

1 error
DynamicSet:               "com.google.gerrit.extensions.registration.DynamicSet"
ReplicationStateListener: "com.googlesource.gerrit.plugins.replication.ReplicationStateListener"

By moving back the replication plugin internal classes
bindings into its proper ReplicationModule the problem is fully
resolved and there aren't just-in-time bindings created
implicitly anymore.

Change-Id: I2bf9dab0d2555310b4d1b0c66528b2aaa2cc5106
diff --git a/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationConfigModule.java b/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationConfigModule.java
index ec9cf50..b0343c9 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationConfigModule.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationConfigModule.java
@@ -23,11 +23,9 @@
 import com.google.inject.Inject;
 import com.google.inject.ProvisionException;
 import com.google.inject.Scopes;
-import com.google.inject.assistedinject.FactoryModuleBuilder;
 import com.google.inject.internal.UniqueAnnotations;
 import com.googlesource.gerrit.plugins.replication.api.ConfigResource;
 import com.googlesource.gerrit.plugins.replication.api.ReplicationConfig;
-import com.googlesource.gerrit.plugins.replication.events.ProjectDeletionState;
 import java.io.File;
 import java.io.IOException;
 import java.nio.file.Files;
@@ -59,12 +57,6 @@
     } else {
       bind(ReplicationConfig.class).to(ReplicationConfigImpl.class).in(Scopes.SINGLETON);
     }
-
-    bind(ReplicationQueue.class).in(Scopes.SINGLETON);
-    bind(ReplicationDestinations.class).to(DestinationsCollection.class);
-
-    install(new FactoryModuleBuilder().build(Destination.Factory.class));
-    install(new FactoryModuleBuilder().build(ProjectDeletionState.Factory.class));
   }
 
   public FileBasedConfig getReplicationConfig() {
diff --git a/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationModule.java b/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationModule.java
index c7e560e..e3e4021 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationModule.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationModule.java
@@ -36,6 +36,7 @@
 import com.googlesource.gerrit.plugins.replication.events.ProjectDeletionReplicationFailedEvent;
 import com.googlesource.gerrit.plugins.replication.events.ProjectDeletionReplicationScheduledEvent;
 import com.googlesource.gerrit.plugins.replication.events.ProjectDeletionReplicationSucceededEvent;
+import com.googlesource.gerrit.plugins.replication.events.ProjectDeletionState;
 import com.googlesource.gerrit.plugins.replication.events.RefReplicatedEvent;
 import com.googlesource.gerrit.plugins.replication.events.RefReplicationDoneEvent;
 import com.googlesource.gerrit.plugins.replication.events.ReplicationScheduledEvent;
@@ -101,5 +102,11 @@
 
     bind(TransportFactory.class).to(TransportFactoryImpl.class).in(Scopes.SINGLETON);
     bind(CloseableHttpClient.class).toProvider(HttpClientProvider.class).in(Scopes.SINGLETON);
+
+    bind(ReplicationQueue.class).in(Scopes.SINGLETON);
+    bind(ReplicationDestinations.class).to(DestinationsCollection.class);
+
+    install(new FactoryModuleBuilder().build(Destination.Factory.class));
+    install(new FactoryModuleBuilder().build(ProjectDeletionState.Factory.class));
   }
 }