我正在使用scala构建一个spin应用程序,我正在关注找到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"))
}
}
如果需要,我可以发布更多代码片段
谢谢,
利安
答案 0 :(得分:4)
IO.apply
采用隐式ActorSystem
。使用actorSystem
将implicit var actorSytem
隐含为隐式,或将actorSystem
明确传递为IO(Http)(actorSystem)