找不到参数marshaller的隐含值:spray.httpx.marshalling.ToResponseMarshaller [Unit]

时间:2015-10-28 06:26:47

标签: json scala marshalling

我有以下代码要执行:

import akka.actor.ActorSystem
import spray.routing.SimpleRoutingApp
import spray.json.DefaultJsonProtocol._
object Server1 extends App with SimpleRoutingApp{
def testing(p:String,q:String){
println(p+"  "+q)
}
implicit val actorSystem = ActorSystem()        
var state:String=""
startServer(interface="localhost",port = 8080){
println("Listening...")         
    get{
        println("incoming..")
        path("state"){
            parameters("alertC".as[String],"alertB".as[String]){   (alertC,alertB)=>{

                    complete{
                        testing(alertC,alertB)
                    }


                }   
            }
        } 
    }
}

}

在编译时错误是: 找不到参数marshaller的隐含值:spray.httpx.marshalling.ToResponseMarshaller [Unit] 错误:testing(alertC,alertB)

1 个答案:

答案 0 :(得分:0)

Spray找不到Unit的编组。例如,从testing返回一个字符串。