开发者

What Java/Scala or .NET web frameworks support modify source code and instantly run workflow e.i. without long rebiuld/redeploy procedures?

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 dyn开发者_如何学Pythonamic 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:

  • Play framework


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.


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.


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜