即使我有导入ExecutionContex.global,也没有执行上下文

时间:2014-02-19 12:29:54

标签: scala playframework-2.2

我有导入import play.api.libs.concurrent.Execution.Implicits._

val lock1 = lock(tweet)
val lock2 = lock(tweet)
for {
  r1 <- lock1
  r2 <- lock2
} yield r1 -> r2

但是这个区块抱怨

Cannot find an implicit ExecutionContext, either require one yourself or import ExecutionContext.Implicits.global
[error]         r2 <- lock2
[error]            ^

1 个答案:

答案 0 :(得分:0)

import scala.concurrent.ExecutionContext.Implicits.global导入此工作正常。但我不知道为什么