I'd go with the 2.1 version, and the new controller instanciation from the Global object.
Here is a Guice example from the doc:
import play.GlobalSettings;
import com.google.inject.Guice;
import com.google.inject.Injector;
public class Global extends GlobalSettings {
private static final Injector INJECTOR = createInjector();
@Override
public <A> A getControllerInstance(Class<A> controllerClass) throws Exception {
return INJECTOR.getInstance(controllerClass);
}
private static Injector createInjector() {
return Guice.createInjector();
}
}
You have to declare a special route for these controllers, with the special @
:
GET /myUrl @controllers.MyController.myMethod()
And you can also take a look at this demo using Spring: https://github.com/guillaumebort/play20-spring-demo