I have a Case Class User and I want to return it as Future(User). But when I do the same I get this error:
No implicits found for parameter executor: ExecutionContext
Can someone help me with the right syntax to convert a non future result to future return type?
If you don't define an ExecutionContext
elsewhere, you can use Scala's global ExecutionContext with either:
import scala.concurrent.ExecutionContext.Implicits.global
or:
implicit val ec: scala.concurrent.ExecutionContext = scala.concurrent.ExecutionContext.global
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.