2
在this链接,文档使用instanceof来封送对象为JSON,如下图所示:编组站在阿卡HTTP
val route = get {
completeWith(instanceOf[Person]) { completionFunction => findPerson(completionFunction) }
}
然而,当我尝试使用相同的我得到的错误“unable to resolve symbol instanceOf
”。我怎样才能解决这个问题?
'import akka.http.scaladsl.server.Directives._' –
谢谢。有效。那么instanceOf是一个指令吗?但是我无法在http://doc.akka.io/docs/akka-http/current/scala/http/routing-dsl/directives/alphabetically.html上找到instanceOf – codingsplash
不是一个指令,更像是一个辅助方法。见https://github.com/akka/akka-http/blob/master/akka-http/src/main/scala/akka/http/scaladsl/server/directives/MarshallingDirectives.scala –