Created
January 9, 2014 04:43
-
-
Save codingricky/8329508 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.google.inject.AbstractModule; | |
import com.google.inject.Guice; | |
import com.google.inject.Injector; | |
import play.Application; | |
import play.GlobalSettings; | |
import services.GreetingService; | |
import services.RealGreetingService; | |
public class Global extends GlobalSettings { | |
private Injector injector; | |
@Override | |
public void onStart(Application application) { | |
injector = Guice.createInjector(new AbstractModule() { | |
@Override | |
protected void configure() { | |
bind(GreetingService.class).to(RealGreetingService.class); | |
} | |
}); | |
} | |
@Override | |
public <T> T getControllerInstance(Class<T> aClass) throws Exception { | |
return injector.getInstance(aClass); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment