Install RestForwarderServletModule only if HTTP transport is used Besides skipping installation of unnecessary servlets this change also fixes an issue with Guice injection dependencies: the @RestGson is bound (from the RestForwarderModule) only if the transport is REST. However, the REST servlets now also depend on the @RestGson and, if another transport is used where RestForwarderModule module is not installed, then we have a missing dependency issue. Change-Id: Id650bf9c4e5f723689f19d6e333afc059c95df66
diff --git a/src/main/java/com/ericsson/gerrit/plugins/highavailability/HttpModule.java b/src/main/java/com/ericsson/gerrit/plugins/highavailability/HttpModule.java index 921d750..e0c6061 100644 --- a/src/main/java/com/ericsson/gerrit/plugins/highavailability/HttpModule.java +++ b/src/main/java/com/ericsson/gerrit/plugins/highavailability/HttpModule.java
@@ -33,7 +33,9 @@ @Override protected void configureServlets() { - install(new RestForwarderServletModule(config)); + if (config.main().transport() == Configuration.Transport.HTTP) { + install(new RestForwarderServletModule(config)); + } if (config.healthCheck().enabled()) { install(new HealthServletModule()); }