Impossible de trouver un implicite ExecutionContext. Vous pourriez passer de pulvérisation scala

J'ai ces deux erreurs:

Error:(39, 20) Cannot find an implicit ExecutionContext. You might pass
an (implicit ec: ExecutionContext) parameter to your method
or import scala.concurrent.ExecutionContext.Implicits.global.
    val pipeline = sendReceive

               ^

Error:(39, 20) not enough arguments for method sendReceive: (implicit refFactory: akka.actor.ActorRefFactory, implicit executionContext: scala.concurrent.ExecutionContext, implicit futureTimeout: akka.util.Timeout)spray.client.pipelining.SendReceive.
Unspecified value parameter executionContext.
    val pipeline = sendReceive
               ^

Mon Code est:

import scala.util.{Success, Failure}
import scala.concurrent.duration._
import akka.actor.ActorSystem
import akka.pattern.ask
import akka.event.Logging
import akka.io.IO
import spray.can.Http
import spray.client.pipelining._
import spray.util._
import argonaut._, Argonaut._
object test {
case class Elevation(location: Location, elevation: Double)
case class Location(lat: Double, lng: Double)
case class GoogleApiResult(status: String, results: List[Elevation])
implicit def locationFormat: CodecJson[Location] =    casecodec2(Location.apply, Location.unapply)("lat", "lng")
implicit def elevationFormat: CodecJson[Elevation] = casecodec2(Elevation.apply, Elevation.unapply)("location", "elevation")
implicit def googleApiResultFormat: CodecJson[GoogleApiResult] = casecodec2(GoogleApiResult.apply, GoogleApiResult.unapply)("status", "results")
object Main extends App {
//we need an ActorSystem to host our application in
implicit val system = ActorSystem("simple-spray-client")
//execution context for futures below
val log = Logging(system, getClass)
log.info("Requesting the elevation of Mt. Everest from Googles Elevation API...")
val pipeline = sendReceive
val responseFuture= pipeline {
Get("http://maps.googleapis.com/maps/api/elevation/json?locations=27.988056,86.925278&sensor=false")
}
responseFuture.onComplete {
case Success(result) =>
println(result)
log.info("The elevation of Mt.Everest is: {} m", result.toString.decodeOption[Elevation].get)
shutdown()
case Failure(error) =>
log.error(error, "Couldn't get elevation")
shutdown()
}
def shutdown(): Unit = {
IO(Http).ask(Http.CloseAll)(1.second).await
system.shutdown()
}
}
}`

OriginalL'auteur kam kimo | 2015-10-23