Reputation: 267140
I'm trying to migrate my older play application to the new play version where you use DI to get the Play.current value.
How can I use an injected Application when I am currently using it in a trait like this:
trait SomeTrait {
lazy val someThing = WrapApp(Play.current)
}
@Singleton
class MyApi @Inject() (currentApplication: Application) extends SomeTrait {
}
I'm not sure how to pass the play.api.Application instance to my trait now?
Upvotes: 2
Views: 38
Reputation: 4268
trait SomeTrait {
def currentApplication: Application
lazy val someThing = WrapApp(currentApplication)
}
@Singleton
class MyApi @Inject() (override val currentApplication: Application) extends SomeTrait {
}
Upvotes: 1