Scala “原因”;找不到参数rs的隐式值:spray.routing.RoutingSettings";
在完全遵循(或者我认为是这样)当时的示例时,我遇到了以下错误:Scala “原因”;找不到参数rs的隐式值:spray.routing.RoutingSettings";,scala,spray,Scala,Spray,在完全遵循(或者我认为是这样)当时的示例时,我遇到了以下错误: [error] /Users/alias/dev/src/main/scala/framework/MyActor.scala:86: could not find implicit value for parameter rs: spray.routing.RoutingSettings [error] def receive = runRoute(routes) [error] 并且无法理解为什么看起来相同的代码不起作用
[error] /Users/alias/dev/src/main/scala/framework/MyActor.scala:86: could not find implicit value for parameter rs: spray.routing.RoutingSettings
[error] def receive = runRoute(routes)
[error]
并且无法理解为什么看起来相同的代码不起作用。我找到了使用隐式调试问题的正确方向
implicitly[RoutingSettings]
从那里我可以确定有一个模棱两可的暗示
Multiple markers at this line
- implicit ActorRefFactory required: if outside of an Actor you need an implicit ActorSystem, inside of an actor this should be the implicit ActorContext
- not enough arguments for method default: (implicit refFactory: akka.actor.ActorRefFactory)spray.routing.RoutingSettings. Unspecified value parameter
refFactory.
- ambiguous implicit values: both value context in trait Actor of type => akka.actor.ActorContext and method system in trait ActorContext of type =>
akka.actor.ActorSystem match expected type akka.actor.ActorRefFactory
我最终发现这是由导入上下文引起的
这花了我太长的时间,所以希望这将节省人们很多时间在未来 尝试添加:def actorrefactory=context
我在这里有这样一个问题,这是因为在与actorrefactory(ActorContext和ActorSystem)匹配的范围内有两个隐式元素的冲突,但您是刚刚删除了导入还是什么?如果我删除任何一个,Scala都会向我抱怨!