JavaRebel jvm plugin allows hot swappable code

Although I’d come across JavaRebel before I was reminded of it last night by a friend who was using it in his company to hot swap code on the jvm in real time. In JavaRebel’s own words here’s what it is.

JavaRebel is a JVM plugin (-javaagent) that enables to reload changes made to Java class files on-the-fly, saving developers the time that it takes to redeploy an application or perform a container restart. It is a generic solution that works for Java EE and Java standalone applications.

Essentially it turns the change->compile->deploy cycle to a change->compile cycle. Watch the 2min screen cast to see it in action. The only thing I’m concerned about a little are the two features it doesn’t support. If you’re not changing superclass or modifying interface relationships then it should be fine.

As of version 1.2.x there is now full Spring support as well. Watch the spring plugin screen cast to see it working.

[…] we have released a JavaRebel plugin for Spring that allows reloading/reinjecting Spring dependencies on-the-fly without reloading the bean factory or application context. The Spring plugin release includes fixes and performance improvements. The plugin will no longer rescan all XML files on every web request and the introduced delay should now be measured in milliseconds. A number of problems with Spring Security has been fixed […]

This sounds ideal. In the past I have seen explicit code written to watch xml config files and resources and to reload the spring context in-container when they change. Why write yourself when it can be done for you?

I wonder if this could be a fully featured and effective replacement for running tomcat within eclipse (JavaRebel with Eclipse WTP) and also if it works remotely. Also apparently linkedin uses it.

Leave a Reply