Stop waiting for build & deploy make code changes. Write code and refresh your browser!

Use DCEVM and add java fields, methods, classes and use them without restarting your application server, it's a modification of the HotSpot VM that allows unlimited class redefinition at run-time. You can add/remove fields and methods and change the super types of a class at run-time. The features of DCEVM are likely to be integrated in a future update of Java 8 as part of JEP 159.

View code changes instantly and increases team velocity!

          DCEVM                  JVM Hot Swap         
Changes to method bodies  yes yes
Adding/removing Methods  yes  no
Adding/removing constructors  yes  no
Adding/removing fields  yes  no
Adding/removing classes  yes  no
Adding/removing annotations  yes  no
Changing static field value  yes  no
Adding/removing enum values  yes  no
Modifying interfaces  yes  no
Replacing superclass  yes  no
Adding/removing implemented interfaces  no  no
Initializes new instance fields  yes  no

 

 

You'll need to patch your own version of java (latest as of today is 1.7.71)

This project is similar to JRebel. Main differences are:

  • HotswapAgent (DCEVM) supports Java8!
  • HotswapAgent does not need any additional configuration for basic project setup.
  • JRebel is currently more mature and contains more plugins.
  • JRebel is neither open source nor free.
  • JRebel modifies bytecode of all classes on reload. You need special IDE plugin to fix debugging.
  • HotswapAgent extraClasspath is similar to JRebel configuration
  • HotswapAgent adds watchResources configuration

Patching Java to use DCEVM

Download from https://github.com/dcevm/dcevm/releases the right patch for java 1.7.71 it is https://github.com/dcevm/dcevm/releases/download/light-jdk7u71%2B2/installer-light-jdk7u71.2.jar

Run it as administrator, it will find your installed Java JDK or you can use "Add installation directory"

Click on both Replace by DCEVM and Install DCEVM as altjvm

Now add to all  your launchers the following -XXaltjvm=dcevm

Reloading Spring Bean

Each application framework (Spring, Hibernate, Logback, ...) needs special reloading mechanism to keep up-to-date after class redefinition (e.g. Hibernate configuration reload after new entity class is introduced). Hotswap agent works as a plugin system and ships preconfigured with all major framework plugins. It is easy to write your custom plugin even as part of your application.

Download agent.jar from https://github.com/HotswapProjects/HotswapAgent/releases

Save anywhere on disk, e.g. in C:\java\hotswap-agent.jar for example

add to all  your launchers the following -javaagent:C:\java\hotswap-agent.jar

Spring plugin uses agent services to:

  • Modify root Spring classes to get Spring contexts and registered scan path
  • Watch for any resource change on a scan path
  • Watch for a hotswap of a class file within a scan path package
  • Reload bean definition after a change
  • ... and many other

References

You might like also

Java Garbage Collector log analysis
These tools assist you in analyzing the garbage collection (GC) log files produced by the JVM when using -verbosegc or -Xloggc:.. or equivalent. GC log file analysis is the most useful technique for identifying exactly what your JVM is doing in terms of GC, and also provides the most useful data for tuning the GC. I really like this tool, nothing to install and excellent graphs! Analyzing JVM Garbage collection logs is not trivial, it needs specialized skills. Besides that …
1236 Days ago
Agile Testing Poster
Agile testing is a software testing practice that follows the principles of agile software development. Agile testing is built upon the philosophy that testers need to adapt to rapid deployment cycles and changes in testing patterns. Providing and getting feedback early, fast and regularly is one of the testers main task. From http://bbv.ch/images/bbv/pdf/downloads/poster/bbv12_poster_agile_testing_1.0_web.pdf You can order a print version at http://www.bbv.ch/de/posterbestellung.html Find more at http://bbv.ch/de/unternehmen/publikationen.html …
2614 Days ago
QUALITY DRIVEN DEVELOPMENT POSTER
From http://bbv.ch/images/bbv/pdf/downloads/poster/bbv11_poster_agile_re.pdf You can order a print version at http://www.bbv.ch/de/posterbestellung.html Find more at http://bbv.ch/de/unternehmen/publikationen.html …
2614 Days ago