Ich rufe eine Webservice wie diese finden:Play-Framework 2.1 - Kann nicht eine implizite ExecutionContext
WS
.url(url)
.get
.map { response => // error occurs on this line
response.status match {
case 200 => Right(response.json)
case status => Left(s"Problem accessing api, status '$status'")
}
}
Der komplette Fehler: Error: Cannot find an implicit ExecutionContext, either require one yourself or import ExecutionContext.Implicits.global
Über den Ausführungskontext. Manche Leute denken, es ist das gleiche wie der globale Kontext von Scala. Es ist jedoch nicht. [Ausführung.scala] (https://github.com/playframework/playframework/blob/2.2.x/framework/src/play/src/main/scala/play/api/libs/concurrent/Execution.scala) verweist auf [Invoker.scala] (https://github.com/playframework/playframework/blob/2.2.x/framework/src/play/src/main/scala/play/core/system/Invoker.scala?source = cc) So ist es eigentlich der Ausführungskontext des Play Actor-Systems. Dadurch können Sie das Verhalten mit der application.conf ändern. – EECOLOR
Der Link "Dieses Problem" ist jetzt defekt. Es gibt jedoch ein Archiv im web.archive: http://web.archive.org/web/20140222113140/http://play.lighthouseapp.com/projects/82401/tickets/899-error-cannot-find-an -implicit-executioncontext-entweder-require-one-yourself-or-import-executioncontextimplicitsglobal – EdgeCaseBerg
@EdgeCaseBerg Vielen Dank, ich habe den Link – EECOLOR