小编Nit*_*...的帖子

找不到隐含的......:akka.http.server.RoutingSetup

在玩akka-http实验1.0-M2时,我试图创建一个简单的Hello world示例.

import akka.actor.ActorSystem
import akka.http.Http
import akka.http.model.HttpResponse
import akka.http.server.Route
import akka.stream.FlowMaterializer
import akka.http.server.Directives._

object Server extends App {

  val host = "127.0.0.1"
  val port = "8080"

  implicit val system = ActorSystem("my-testing-system")
  implicit val fm = FlowMaterializer()

  val serverBinding = Http(system).bind(interface = host, port = port)
  serverBinding.connections.foreach { connection ?
    println("Accepted new connection from: " + connection.remoteAddress)
    connection handleWith Route.handlerFlow {
      path("") {
        get {
          complete(HttpResponse(entity = "Hello world?"))
        }
      }
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

编译失败 could not find implicit value …

scala akka akka-http

6
推荐指数
1
解决办法
2490
查看次数

标签 统计

akka ×1

akka-http ×1

scala ×1