ConfigServlet: use provider to get "MetaDataUpdate.User"
Change-Id: Iaee23fef131018bcd89421108ef18414917127ad
diff --git a/src/main/java/com/googlesource/gerrit/plugins/simplesubmitrules/config/ConfigServlet.java b/src/main/java/com/googlesource/gerrit/plugins/simplesubmitrules/config/ConfigServlet.java
index 9721b1e..6f36519 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/simplesubmitrules/config/ConfigServlet.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/simplesubmitrules/config/ConfigServlet.java
@@ -28,6 +28,7 @@
import com.google.gerrit.server.project.ProjectConfig;
import com.google.gerrit.server.project.ProjectResource;
import com.google.inject.Inject;
+import com.google.inject.Provider;
import com.google.inject.Singleton;
import com.googlesource.gerrit.plugins.simplesubmitrules.api.SubmitConfig;
import java.io.IOException;
@@ -39,14 +40,14 @@
implements RestReadView<ProjectResource>, RestModifyView<ProjectResource, SubmitConfig> {
private final ProjectCache projectCache;
private final PermissionBackend permissionBackend;
- private final MetaDataUpdate.User metaDataUpdateFactory;
+ private final Provider<MetaDataUpdate.User> metaDataUpdateFactory;
private final ConfigTranslator configTranslator;
@Inject
ConfigServlet(
ProjectCache projectCache,
PermissionBackend permissionBackend,
- MetaDataUpdate.User metaDataUpdateFactory,
+ Provider<MetaDataUpdate.User> metaDataUpdateFactory,
ConfigTranslator configTranslator) {
this.projectCache = projectCache;
this.permissionBackend = permissionBackend;
@@ -75,7 +76,7 @@
.check(ProjectPermission.WRITE_CONFIG);
IdentifiedUser user = resource.getUser().asIdentifiedUser();
- try (MetaDataUpdate md = metaDataUpdateFactory.create(projectName, user)) {
+ try (MetaDataUpdate md = metaDataUpdateFactory.get().create(projectName, user)) {
ProjectConfig projectConfig = ProjectConfig.read(md);
configTranslator.applyTo(inConfig, projectConfig);
projectConfig.commit(md);