Fix DbInjector creation in WebAppinitializer

The creation of the DbInjector under Tomcat was broken by change
Ifebb7fd33 because the initial list of modules was not passed to
the Guice injector.

Additionally, the override needs to happen on the DbInjector and not
on the cfgInjector as it was before.

Bug: Issue 10858
Change-Id: I4e19a92328bdf389d1c55aa95599a50a1bf101d6
This commit is contained in:
Luca Milanesio
2019-05-16 07:40:02 +02:00
parent d3c1a26446
commit cf40b39a3c

View File

@@ -260,8 +260,7 @@ public class WebAppInitializer extends GuiceServletContextListener implements Fi
Module configModule = new GerritServerConfigModule();
modules.add(configModule);
modules.add(new DropWizardMetricMaker.ApiModule());
return Guice.createInjector(
PRODUCTION, LibModuleLoader.loadModules(cfgInjector, LibModuleType.DB_MODULE));
return Guice.createInjector(PRODUCTION, modules);
}
private Injector createDbInjector() {
@@ -269,7 +268,9 @@ public class WebAppInitializer extends GuiceServletContextListener implements Fi
modules.add(new SchemaModule());
modules.add(NoteDbSchemaVersionCheck.module());
modules.add(new AuthConfigModule());
return cfgInjector.createChildInjector(modules);
return cfgInjector.createChildInjector(
ModuleOverloader.override(
modules, LibModuleLoader.loadModules(cfgInjector, LibModuleType.DB_MODULE)));
}
private Injector createSysInjector() {