package plugins;

import com.google.inject.Guice;
import com.google.inject.Injector;
import io.sphere.sdk.client.PlayJavaClient;
import play.Application;
import play.GlobalSettings;

public class Global extends GlobalSettings {

    private Injector injector;

    @Override
    public void onStart(final Application app) {
        super.onStart(app);
        injector = createInjector(app);
    }

    protected Injector createInjector(Application app) {
        return Guice.createInjector(new ProductionModule(app));
    }

    @Override
    public void onStop(final Application app) {
        injector.getInstance(PlayJavaClient.class).close();
        super.onStop(app);
    }

    @Override
    public <A> A getControllerInstance(final Class<A> controllerClass) throws Exception {
        return injector.getInstance(controllerClass);
    }

}

@@ -78,16 +78,54 @@
 jector;%0A
+import controllers.CountryOperations;%0A
 import i
@@ -160,16 +160,16 @@
 Client;%0A
-
 import p
@@ -347,32 +347,66 @@
 lication app) %7B%0A
+        checkDefaultCountry(app);%0A
         super.on
@@ -513,32 +513,32 @@
 lication app) %7B%0A
-
         return G
@@ -584,32 +584,163 @@
 e(app));%0A    %7D%0A%0A
+    private void checkDefaultCountry(Application app) %7B%0A        CountryOperations.of(app.configuration()).defaultCountry();%0A    %7D%0A%0A
     @Override%0A  

Check default country is defined before starting app.