我使用almeidap的DAO设计 GitHub Gist作为我的数据库层的示例。不幸的是,自 Play 2.5 版以来已弃用,所以我不能使用:current
trait MongoHelper extends ContextHelper{
lazy val db = ReactiveMongoPlugin.db
}
也不
trait MongoHelper extends ContextHelper {
lazy val reactiveMongoApi = current.injector.instanceOf[ReactiveMongoApi]
lazy val db = reactiveMongoApi.db
}
由于我无法注入reactiveMongoApi
特征,我想知道如何解决这个问题。尽管不鼓励使用已弃用的方法,但我无法启动我的应用程序,因为我的There is no started application
启动代码会在应用程序启动时将虚拟数据插入我的数据库中导致异常。