1

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.

John Doe
  • 275
  • 3
  • 12
  • You can have an abstract `def reactiveMongoApi` in the trait, the implementation class having to define it appriately, possibly using DI (as indicated in the [doc](http://reactivemongo.org/releases/0.11/documentation/tutorial/play2.html)). – cchantep Jun 09 '16 at 00:07

0 Answers0