Hot Deploy & Live Reload
- Overview
- Spring Boot
- JRebel
- HotswapAgent
- Jetty
- TomEE
- Using Vaadin Copilot & Vaadin IDE Plugin
- Manual Installation
- Testing
- Efficiency
- Additional Considerations
JetBrains Runtime offers hotswapping of any type of Java changes into a running JVM through the debug connection, typically established by the IDE, to the running JVM. With other JDKs there’s limited support for only some types of Java changes.
In addition to getting the Java changes into the running JVM, most frameworks have some global data that needs to be updated when a class changes — or some caches that need to be cleared for the new class to take effect. HotswapAgent is a collection of plugins for various frameworks, which offers these kinds of global updates and cache clearing when needed.
Using Vaadin Copilot & Vaadin IDE Plugin
If you are using IntelliJ and the Vaadin plugin, you can launch your application using the 'Debug using HotswapAgent' option without any additional configuration.
When running your application using Debug using HotswapAgent, the Vaadin plugin checks if you’re using the proper JDK, if HotswapAgent is available, and applies additional required JVM arguments.
If you’re using VS Code and Vaadin Copilot, you can configure everything automatically from the Copilot Development Workflow guide. Follow the instruction to install the proper JDK, install the HotswapAgent library, and prepare the run configuration.
Manual Installation
Setting up hotswapping manually, consists of three steps:
-
Install JetBrains Runtime;
-
Download HotswapAgent and install it into JetBrains Runtime; and
-
Run the application using JetBrains Runtime with additional parameters.
JetBrains Runtime
You can download the latest version from the JetBrains GitHub release page. Be sure to select the correct architecture. Use JetBrains Runtime to execute your application, not necessarily your IDE.
HotswapAgent
You can download HotswapAgent from the HotswapAgent GitHub release page. You’ll need version 1.4.2 or later.
Download the JAR file and place it inside the JetBrains Runtime installation directory as lib/hotswap/hotswap-agent.jar
. Use this exact file name for JetBrains Runtime. You’ll need to create the hotswap
folder.
If you want to know more about the features of HotswapAgent, the documentation in the HotswapAgent webpage is a good resource.
Running the Application
To enable hotswapping when launching your application, pass -XX:+AllowEnhancedClassRedefinition -XX:HotswapAgent=fatjar
as JVM arguments — not program arguments.
If you have a Spring Boot application, you launch it by running the main()
method of your application class. After you’ve launched it once, you’ll have a run configuration available. You can edit that run configuration in your IDE so that you can select the proper JDK and give the necessary parameters.
To do that in IntelliJ IDEA, select