在更新到喷雾1.2后,我遇到了一个与我的JSON-Marshallers完全兼容的问题.在HttpService中执行以下操作
trait TestHttpService extends HttpService with SprayJsonSupport with DefaultJsonProtocol{ self : ActorLogging =>
case class Test(hallo: String, test: String)
implicit val storyJsonFormat = jsonFormat2(Test.apply)
def test(implicit m : Marshaller[Future[Test]]) = 17
def hallo = test
}
Run Code Online (Sandbox Code Playgroud)
导致以下错误:
could not find implicit value for parameter marshaller:
spray.httpx.marshalling.Marshaller[scala.concurrent.Future[amanuensis.story.Story]]
Run Code Online (Sandbox Code Playgroud)
当我删除未来时,一切运作良好:
trait TestHttpService extends HttpService with SprayJsonSupport with DefaultJsonProtocol { self : ActorLogging =>
case class Test(hallo: String, test: String)
implicit val storyJsonFormat = jsonFormat2(Test.apply)
def test(implicit m : Marshaller[Test]) = 17
def hallo …Run Code Online (Sandbox Code Playgroud) 我无法按照此处的说明创建未来.它表示您可以Future使用以下代码直接创建:
import akka.dispatch.Await
import akka.dispatch.Future
import akka.util.duration._
val future = Future {
"Hello" + "World"
}
val result = Await.result(future, 1 second)
Run Code Online (Sandbox Code Playgroud)
使用完全相同的代码,我得到一个错误消息,说:error: could not find implicit value for parameter executor: akka.dispatch.ExecutionContext.所有我能找到的ExecutionContext就是,你可以用它"做事".在文档中,我发现的唯一一行是:
implicit val ec = ExecutionContect.fromExecutionService(yourExecutionServiceGoesHere)
Run Code Online (Sandbox Code Playgroud)
但这对我没用.有人对我这个话题有什么建议吗?如何在Future不询问的情况下创建新的Actor?