I used the DAO design GitHub Gist by almeidap as an example for my database layer. Unfortunately, current
is deprecated since the Play release 2.5, so I can't use:
trait MongoHelper extends ContextHelper{
lazy val db = ReactiveMongoPlugin.db
}
nor
trait MongoHelper extends ContextHelper {
lazy val reactiveMongoApi = current.injector.instanceOf[ReactiveMongoApi]
lazy val db = reactiveMongoApi.db
}
Since I cannot inject reactiveMongoApi
into a trait I am wondering how I can solve this issue. Despite the fact that the use of deprecated method is discouraged, I cannot start my application because I get the exception There is no started application
caused by my startup code which inserts dummy data into my database on app launch.