gpt4 book ai didi

Scala - Spray.io - sbt-revolver - jrebel - 在重新加载时看不到 HttpService(或任何东西)的变化

转载 作者:行者123 更新时间:2023-12-04 05:09:31 25 4
gpt4 key购买 nike

我可以看到 sbt-revolver 已设置并在喷雾 jar 上运行,但是当我向服务发出请求时,我的更改没有出现。

你可以在日志中看到 jrebel 正在做它的事情:

    [success] Total time: 1 s, completed Feb 24, 2013 3:13:18 AM
app: [INFO] [02/24/2013 03:13:19.497] [com-example-Boot-spray.io.io-bridge-dispatcher-7] [akka://com-example-Boot/user/io-bridge] akka://com-example-Boot/user/io-bridge started
app: [INFO] [02/24/2013 03:13:19.851] [com-example-Boot-akka.actor.default-dispatcher-2] [akka://com-example-Boot/user/http-server] akka://com-example-Boot/user/http-server started on localhost/127.0.0.1:9000
> ~products
[success] Total time: 0 s, completed Feb 24, 2013 3:13:23 AM
1. Waiting for source changes... (press enter to interrupt)
[info] Compiling 1 Scala source to /Users/tripled153/Development/src/Foundationv2/spray-template/target/scala-2.10/classes...
[success] Total time: 2 s, completed Feb 24, 2013 3:13:33 AM
2. Waiting for source changes... (press enter to interrupt)

但是在我的特征中更改消息不会在刷新时出现。
package com.example

import akka.actor.Actor
import spray.routing._
import spray.http._
import MediaTypes._


// we don't implement our route structure directly in the service actor because
// we want to be able to test it independently, without having to spin up an actor
class MyServiceActor extends Actor with MyService {

// the HttpService trait defines only one abstract member, which
// connects the services environment to the enclosing actor or test
def actorRefFactory = context

// this actor only runs our route, but you could add
// other things here, like request stream processing
// or timeout handling
def receive = runRoute(myRoute)
}


// this trait defines our service behavior independently from the service actor
trait MyService extends HttpService {

val myRoute =
path("") {
get {
respondWithMediaType(`text/html`) { // XML is marshalled to `text/xml` by default, so we simply override here
complete {
<html>
<body>
<h1>Say hello to <i>spray-routing</i> on <i>spray-can</i>!</h1>
</body>
</html>
}
}
}
}

}

这是建立在喷雾 jar 上的例子,上面装有左轮手枪。
https://github.com/spray/spray-template

最佳答案

问题是路由只在服务启动时构建一次。尝试用 dynamic 包裹完整的路线指令为每个请求重建它。

编辑:看到这个 mailing list thread关于这个话题。

关于Scala - Spray.io - sbt-revolver - jrebel - 在重新加载时看不到 HttpService(或任何东西)的变化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15049913/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com