【发布时间】:2015-09-14 22:14:14
【问题描述】:
从 Play Framework 2.4 开始,可以使用依赖注入(使用 Guice)。
在我的 ActionBuilders 中使用对象(例如 AuthenticationService)之前:
object AuthenticatedAction extends ActionBuilder[AuthenticatedRequest] {
override def invokeBlock[A](request: Request[A], block: (AuthenticatedRequest[A]) => Future[Result]): Future[Result] = {
...
AuthenticationService.authenticate (...)
...
}
}
现在AuthenticationService 不再是一个对象,而是一个类。我怎样才能在我的ActionBuilder 中使用AuthenticationService?
【问题讨论】:
标签: scala playframework dependency-injection guice guice-3