我正在 scala 中构建一个喷雾应用程序,我正在按照 here 的示例进行操作,但是当我去编译时出现此错误

Error:(38, 7) could not find implicit value for parameter system: akka.actor.ActorSystem
                IO(Http) ! Http.Bind(webServer,
                  ^

谷歌搜索让我无处可去,这是我的应用程序的代码
package au.net.hivemedia.polydeploy

import akka.actor.{Props, ActorRef, ActorSystem}
import akka.io.IO
import au.net.hivemedia.polydeploy.dono.http.WebServerActor
import spray.can.Http

/**
 * PolyDeploy Dono - Braeburn
 *
 * Copyright (c) Hive Media Production, 2014.
 * All rights reserved. Do not redistribute
 *
 */
object App extends App {

  final val VERSION = "1.0-SNAPSHOT"
  final val CODENAME = "Twilight Sparkle"

  private var instance: Dono = _
  private var actorSystem: ActorSystem = _
  private var webServer: ActorRef = _

  override def main(args: Array[String]) {
    println("Starting PolyDeploy Dono v" + VERSION)
    println("=+ Project Version Codename: " + CODENAME)

    instance = new Dono()
    println("=+ Loading required items into the runtime")
    instance.load()

    println("=+ Loading new Actor System")
    actorSystem = ActorSystem("DonoActorSystem")

    println("=+ Starting web interface server")
    webServer = actorSystem.actorOf(Props[WebServerActor], name = "WebServer")

    IO(Http) ! Http.Bind(webServer,
                         interface = instance.getConfiguration().getString("web-bind-host"),
                         port = instance.getConfiguration().getInt("web-bind-port"))

  }
}

如果需要,我可以发布更多代码片段

谢谢,

利亚姆

最佳答案

IO.apply 采用隐式 ActorSystem 。通过使用 actorSystemimplicit var actorSytem 设为隐式,或将 actorSystem 显式传递为 IO(Http)(actorSystem)

关于scala - IO(Http) 导致错误 "could not find implicit value for parameter system: akka.actor.ActorSystem",我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/26735649/

10-11 06:13