我正在尝试在我的 Play+Scala 应用程序 (2.5x) 中使用 Deadbolt。我在 build.sbt (Play 2.5x) 中添加了以下内容:
libraryDependencies += "be.objectify" %% "deadbolt-scala" % "2.5.1"
在我的 conf/application.conf 中:
enabled += "be.objectify.deadbolt.scala.DeadboltModule"
当我访问服务器时,在“sbt run”之后,我立即得到这个错误:
play.api.UnexpectedException: Unexpected exception[CreationException: Unable to create injector, see the following errors:
1) No implementation for be.objectify.deadbolt.scala.cache.HandlerCache was bound.
while locating be.objectify.deadbolt.scala.cache.HandlerCache
for parameter 1 at be.objectify.deadbolt.scala.ActionBuilders.<init>(ActionBuilders.scala:30)
at be.objectify.deadbolt.scala.DeadboltModule.bindings(DeadboltModule.scala:32):
Binding(class be.objectify.deadbolt.scala.ActionBuilders to self) (via modules: com.google.inject.util.Modules$OverrideModule -> play.api.inject.guice.GuiceableModuleConversions$$anon$1)
2) No implementation for be.objectify.deadbolt.scala.cache.HandlerCache was bound.
while locating be.objectify.deadbolt.scala.cache.HandlerCache
for parameter 1 at be.objectify.deadbolt.scala.DeadboltActions.<init>(DeadboltActions.scala:34)
at be.objectify.deadbolt.scala.DeadboltModule.bindings(DeadboltModule.scala:30):
Binding(class be.objectify.deadbolt.scala.DeadboltActions to self) (via modules: com.google.inject.util.Modules$OverrideModule -> play.api.inject.guice.GuiceableModuleConversions$$anon$1)
2 errors]
at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(DevServerStart.scala:180)
at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(DevServerStart.scala:131)
at scala.Option.map(Option.scala:146)
at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1.apply(DevServerStart.scala:131)
at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1.apply(DevServerStart.scala:129)
at scala.util.Success.flatMap(Try.scala:231)
我没有进行其他代码更改。即使我还没有编写任何代码行来使用 Deadbolt ,为什么它会失败?