I am using Play! framework 1.2.5 for one of my application. Initially I was resolving dependencies either by creating new instance of the class or using factory. But my application grows and it becomes harder to manage dependencies in such way. I'm going to move to dependency injection with Google Guice
Looks like, for every controller, I have to write
requestStaticInjection(MyController.class);
to inject service in controller
@Inject
static MyService mySerivce;
This is frustrating, I don't like that controllers has static methods and can access only static variables. I would like to pass dependencies to constructor of controller and I don't want to declare static fields.
Why methods of play controllers are static ? Is it some kind of limitation ? Is there are other good way to inject classes into Play! controllers