Fix cyclic dependency when using site_path from system_config table

The starting mode where site_path is not specified (as a system property)
and Gerrit first connects to the database using the ReviewDb JNDI
property from the servlet container was broken since I60f585f5ef due to
a cyclic dependency in Guice bindings.

Make sure to inject the non-wrapped SchemaFactory<ReviewDb> in the
SitePathFromSystemConfigProvider.

Change-Id: Ie283a5498e981642a82aac1fcb8b33b0c881fc84
This commit is contained in:
Saša Živkov
2017-06-13 12:49:42 +02:00
parent 273b005c46
commit d0b688d3ad

View File

@@ -17,6 +17,7 @@ package com.google.gerrit.httpd;
import com.google.gerrit.reviewdb.client.SystemConfig;
import com.google.gerrit.reviewdb.server.ReviewDb;
import com.google.gerrit.server.config.SitePath;
import com.google.gerrit.server.schema.ReviewDbFactory;
import com.google.gwtorm.server.OrmException;
import com.google.gwtorm.server.SchemaFactory;
import com.google.inject.Inject;
@@ -31,7 +32,7 @@ class SitePathFromSystemConfigProvider implements Provider<Path> {
private final Path path;
@Inject
SitePathFromSystemConfigProvider(SchemaFactory<ReviewDb> schemaFactory)
SitePathFromSystemConfigProvider(@ReviewDbFactory SchemaFactory<ReviewDb> schemaFactory)
throws OrmException {
path = read(schemaFactory);
}