Today I found spring loaded (https://github.com/spring-projects/spring-loaded)
in short this is a java agent that enables class reloading of already running VM.
Simply this means zero deployment time (in many cases).
It is like a free and open source alternative of JRebel.
Spring Loaded allows you to add/modify/delete methods/fields/constructors. The annotations on types/methods/fields/constructors can also be modified and it is possible to add/remove/change values in enum types.
There is a preliminary java8 support. There is also another project DCEVM ( which is also great but supports only till JRE 6 update 26). More info here http://ssw.jku.at/dcevm/
But lets stop speaking and show you how it works.
In short you just need to pass the agent when starting the vm and that’s it.
>java -javaagent:D:/Downloads/springloaded-1.2.0.BUILD-20140409.201438-12.jar -noverify org.gochev.MainClass
I am using this Build since I am running Java 8 and this is currently the latest .
The code I in my simple app is the following:
A POJO like this :
and a MainClass like this:
So I can change the DynamicReloadedClass while the main method in the MainClass is looping. You can see this in action here :
http://www.screencast.com/t/KIFIxv7j
Awesome ... and free !
in short this is a java agent that enables class reloading of already running VM.
Simply this means zero deployment time (in many cases).
It is like a free and open source alternative of JRebel.
Spring Loaded allows you to add/modify/delete methods/fields/constructors. The annotations on types/methods/fields/constructors can also be modified and it is possible to add/remove/change values in enum types.
There is a preliminary java8 support. There is also another project DCEVM ( which is also great but supports only till JRE 6 update 26). More info here http://ssw.jku.at/dcevm/
But lets stop speaking and show you how it works.
In short you just need to pass the agent when starting the vm and that’s it.
>java -javaagent:D:/Downloads/springloaded-1.2.0.BUILD-20140409.201438-12.jar -noverify org.gochev.MainClass
I am using this Build since I am running Java 8 and this is currently the latest .
The code I in my simple app is the following:
A POJO like this :
package org.gochev; public class DynamicReloadedClass { private int age = 30; public int getAge() { return age; } public void setAge(int age) { this.age = age; } }
and a MainClass like this:
package org.gochev; import java.util.Scanner; public class MainClass { public static void main(String[] args) { try (Scanner scanner = new Scanner(System.in)) { while (true) { System.out.println("test " + new DynamicReloadedClass().getAge()); scanner.next(); } } } }
So I can change the DynamicReloadedClass while the main method in the MainClass is looping. You can see this in action here :
http://www.screencast.com/t/KIFIxv7j
Awesome ... and free !
Comments