package controllers;

import common.contexts.ProjectContext;
import play.inject.Injector;
import play.libs.F;
import play.mvc.Controller;
import play.mvc.Result;
import productcatalog.controllers.HomeController;
import setupwidget.controllers.SetupController;

import javax.inject.Inject;
import javax.inject.Singleton;

/**
 * Controller for main web pages like index, imprint and contact.
 */
@Singleton
public final class ApplicationController extends Controller {
    private final Injector injector;
    private final SetupController setupController;
    private final ProjectContext projectContext;


    @Inject
    public ApplicationController(final Injector injector, final SetupController setupController, final ProjectContext projectContext) {
        this.injector = injector;
        this.setupController = setupController;
        this.projectContext = projectContext;
    }

    public F.Promise<Result> index() {
        return setupController.handleOrFallback(() -> {
            final HomeController homeController = injector.instanceOf(HomeController.class);
            final String defaultLanguage = projectContext.defaultLanguage().toLanguageTag();
            return homeController.show(defaultLanguage);
        });
    }

    public Result untrail(final String path) {
        return movedPermanently("/" + path);
    }
}

@@ -553,58 +553,8 @@
 er;%0A
-    private final ProjectContext projectContext;%0A%0A
 %0A   
@@ -661,45 +661,8 @@
 ller
-, final ProjectContext projectContext
 ) %7B%0A
@@ -747,54 +747,8 @@
 er;%0A
-        this.projectContext = projectContext;%0A
     
@@ -938,16 +938,109 @@
 class);%0A
+            final ProjectContext projectContext = injector.instanceOf(ProjectContext.class);%0A
         

Remove injected dependency to avoid conflict with setup controller