I'm trying to move to compile-time dependency injection using Play Framework 2.6 in Java. My reading of the Play 2.6 Migration Guide under "Scala Controller Changes", leads me to believe that I should pass an instance of ControllerComponents
into my controller classes; but I can't find a method that provides those components.
play.api.BuiltInComponentsFromContext
defines a controllerComponents()
method, but the Java version of that class, play.BuiltInComponentsFromContext
, does not.
What is going on?
Under "Using Dependency Injection" in the Play 2.6 (Java) documentation, it talks about overriding javaHandlerComponents
in BuiltInComponents
. OK fine, but does that mean I have to define all of my actions as separate classes? Can I not use Controller classes if I want to do compile-time dependency injection in Java?