哪些 Java/Scala 或 .NET Web 框架支持修改源代码并立即运行工作流 ei,而无需长时间的重新构建/重新部署过程?

发布于 2024-08-28 13:08:05 字数 425 浏览 9 评论 0原文

据我所知,Ruby 或 Python 等动态语言相对于 Java/Scala/C# 等的主要优势是将源代码更改“热”应用到正在运行的应用程序。支持相同工作流程(动态应用对配置和源代码的更改)的 JVM 或 .NET 框架有哪些?他们还可以观察自定义配置的更改并通知应用程序吗?

注意:JVM/.NET 上的动态语言框架(例如 Grails 或 Compojure)超出了本文的范围。

编辑:我的意思不仅是修改方法体,还包括添加/删除方法、字段和类。完成编辑和观察浏览器中的变化之间的平均时间是多少?

不错的解决方案

As far as I can see the key advantage of dynamic languages like Ruby or Python over Java/Scala/C# etc is "hot" applying of your changes to source code to the running application. What are the frameworks for JVM or .NET that support the same workflow - apply changes to configuration and source code on the fly? Can they also watch changes to custom configurations and notify application?

Note: Frameworks for dynamic languages on JVM/.NET like Grails or Compojure are out of scope here.

EDIT: I mean not only modification of a method body, but adding/deleting methods, fields and classes. What is average time between finishing of editing and observing changes in your browser?

NICE SOLUTIONS:

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

长伴 2024-09-04 13:08:05

好问题!在java世界中:

在所有java框架中,JVM热插拔功能允许您的调试器进行一些适当的更改,但是您有一些限制 - 例如:您不能更改类层次结构,添加方法等。

有一个商业产品,< a href="http://www.zeroturnaround.com/jrebel/comparison" rel="nofollow noreferrer">JRebel,它宣传自己允许您动态地进行几乎任何代码更改 - 我从来没有能够我自己让它正常工作,但你可能会有更好的运气。

除此之外,我知道 GWT 的开发模式允许任意更改而无需重新编译,我不知道如果 GWT 不具有该功能,那么它不会成为直接编写 javascript 的有力竞争对手。但是,请记住,GWT 不是传统的 Web 框架,它全部运行在客户端。

最后,还有服务器端的 Play 框架,它也将当您刷新浏览器时,自动重新加载具有任意更改的 Java 类。

Great question! In the java world:

In all java frameworks, the JVM hotswap functionality allows your debugger to make some changes in place, however you are somewhat limited - e.g.: you cannot change class hierarchies, add methods, etc.

There is a commercial product, JRebel, which advertises itself as allowing you to make almost any code change dynamically - I have never been able to get it to work properly myself, but you may be have better luck.

Outside that, I know GWT's dev mode allows arbitrary changes without needing to recompile, I don't think GWT would be a viable competitor to directly writing javascript if it didn't have that feature. However, keep in mind that GWT isn't a traditional web framework, it all runs on the client side.

Finally, there is the Play framework, on the server side, which will also automatically reload java classes with arbitrary chages, when you refresh your browser.

孤檠 2024-09-04 13:08:05

我已将 LiftJRebel 没有问题。您只需正确配置它,在一个终端中启动 Web 服务器,并使用 maven scala::cc 保留另一个终端。这将自动重新编译所有内容(如果您使用此处的配置,则一切必要) ,JRebel 将立即使更改在 Web 服务器上可用。

I have used Lift with JRebel without problem. You just have to configure it correctly, start the web server in one terminal, and keep another terminal with maven scala::cc. That will recompile everything automatically (everything necessary if you use the configuration here), and JRebel will instantly make the changes available on the web server.

深海夜未眠 2024-09-04 13:08:05

Apache 的 Java servlet Tomcat 服务器有一个配置选项来“监视”资源。如果监视的 Servlet 或 Web 应用程序发生更改(即,新代码上传到服务器),Tomcat 会自动重新加载它。

根据我的经验,当与其他高级功能(例如,用户目录)混合时,此功能有些损坏,但除此之外,它的工作原理与广告中所宣传的一样。

Apache's Tomcat server for Java servlets has a configuration option to "watch" resources. If a watched servlet or web application is changed (i.e., new code is uploaded to the server), Tomcat automagically reloads it.

From my experience, this feature is somewhat broken when mixed with other advanced features (e.g., user-dirs), but otherwise works as advertised.

夜吻♂芭芘 2024-09-04 13:08:05

你不需要一个框架。当您从 eclipse 运行 Java 应用程序并修改源代码时,eclipse 将尝试将新代码修补到正在运行的 VM 中。如果被替换的方法当前正在执行,这甚至可以工作(在这种情况下,方法执行将从方法的开头重新开始)。某些更改无法热部署,例如删除公共方法或更改子类型关系。

当然,如果您的应用程序缓存了内容(例如,在启动期间设置读取),则这些缓存将不会重新计算,尽管您可能可以在调试器中手动调用解析方法。

You don't need a framework for that. When you run a Java application from eclipse, and modify the source, eclipse will attempt to patch the new code into the running VM. This even works if the methods being replaced are currently executing (method execution will start over at the beginning of the method in such a case). Certain changes can not be hot-deployed, for instance deleting a public method, or changing subtype relationships.

Of course, if your application caches stuff (for instance, setting read during startup), those cache will not be recomputed, though you could probably invoke the parsing method manually in the debugger.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文