Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Scala Convert a Variable to Future?

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?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

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
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading