Skip to content

Hot Reload beta

The written code can be made effective without restarting the application. It supports changes in properties and methods of classes (including proxy classes), SpringBoot, MybatisPlus, etc., to improve development efficiency.

Enable hot reload

Click The icon changes to to turn on hot reload. Start the project in the big airplane mode and hot reload will take effect.

  • Off status

hotswap_off

  • On status

hotswap_on

If the prompt DCEVM is not installed is prompted when starting the project, check whether the command java -XXaltjvm=dcevm -version can be output normally. If not, you need to install DCEVM first.

dcevm_not_install.png

Use hot reload

Start the project in the state of the big plane, the project outputs the following log, and prints the loaded hot reload plug-in.

text
DebugTools: 2025-01-07 16:41:07.909    INFO [main] i.g.f.d.t.h.c.HotswapAgent 44 : open hot reload unlimited runtime class redefinition.{3.3.0}
DebugTools: 2025-01-07 16:41:08.498    INFO [main] i.g.f.d.t.h.c.c.PluginRegistry 132 : Discovered plugins: [JdkPlugin, ClassInitPlugin, AnonymousClassPatch, WatchResources, HotSwapper, Proxy, Spring, MyBatis]

After writing the code, hot reload is automatically triggered after compiling the project through idea (explore the idea shortcut keys yourself).

  • Start the project in Run mode. You can compile the project in the following way to trigger hot reload

build_project.png

  • Start the project in Debug mode. Not only can you compile the project in the above Run way to trigger hot reload, you can also recompile the class in the Compile and Reload Modified Files way in the right-click menu to trigger hot reload.

compile_reload_file.png

  • Xml files can also compile the project to trigger hot reload through the above Run method, and can also trigger hot reload separately through the Compile 'xxx.xml' to Target method in the right-click menu.

compile_xml.png

The console will output relevant hot reload information.

text
DebugTools: 2025-01-07 16:50:22.205  RELOAD [Thread-26] i.g.f.d.t.h.c.p.s.s.ClassPathBeanDefinitionScannerAgent 210 : Registered Spring bean 'testController'

In what situations can hot reload be used

Ordinary class files

  • Add new class files
  • Add/modify properties/methods/inner classes in existing classes.
  • Anonymous inner class
  • Enum class

Click Hot reload of class files for details

Proxy class

  • Java JDK proxy class.

  • Cglib proxy class.

Click Hot reload proxy class for details

SpringBoot Bean

  • Controller
  • Service
  • Component
  • Repository

Click SpringBoot for details

MyBatis

  • Mapper (create/modify)

  • Xml (create/modify)

TIP

MyBatis currently supports the Spring environment, other situations are unknown.

Click MyBatis for details

MyBatisPlus

  • Entity (create/modify)

  • Mapper (create/modify)

  • Xml (create/modify)

TIP

MyBatisPlus currently supports the Spring environment, other situations are unknown.

Click MyBatisPlus for details

Install DCEVM

java 8

window/mac

Download the .jar file for the corresponding version. Currently only the following versions of JDK are supported, please select the corresponding version.

java versiondownload by debug toolsdownload by github
1.8.0_181DCEVM-8u181-installer.jarDCEVM-8u181-installer.jar
1.8.0_172DCEVM-8u172-installer.jarDCEVM-8u172-installer.jar
1.8.0_152DCEVM-8u152-installer.jarDCEVM-8u152-installer.jar
1.8.0_144DCEVM-8u144-installer.jarDCEVM-8u144-installer.jar
1.8.0_112DCEVM-8u112-installer.jarDCEVM-8u112-installer.jar
1.8.0_92DCEVM-8u92-installer.jarDCEVM-8u92-installer.jar
1.8.0_74DCEVM-8u74-installer.jarDCEVM-8u74-installer.jar
1.8.0_66DCEVM-8u66-installer.jarDCEVM-8u66-installer.jar
1.8.0_51DCEVM-8u51-installer.jarDCEVM-8u51-installer.jar
1.8.0_45DCEVM-8u45-installer.jarDCEVM-8u45-installer.jar

Run the corresponding java -jar DCEVM-8uXX-installer.jar file, find the corresponding version, and click the Install DCEVM as altjvm button.

dcevm-installer.png

linux

For example, if you enter java -XXaltjvm=dcevm -version, you will get the following prompt

text
Error: missing `dcevm' JVM at `/home/java/jdk1.8.0_291/jre/lib/amd64/dcevm/libjvm.so'.
Please install or use the JRE or JDK that contains these missing components.

Download the corresponding version of the file and rename it to libjvm.so and move it to the directory extracted above.

java versiondownload by debug toolsdownload by github
>= 1.8.0_181libjvm181.solibjvm181.so
1.8.0_172libjvm172.solibjvm172.so
1.8.0_152libjvm152.solibjvm152.so
1.8.0_144libjvm144.solibjvm144.so
1.8.0_112libjvm112.solibjvm112.so
1.8.0_92libjvm92.solibjvm92.so
1.8.0_74libjvm74.solibjvm74.so
<= 1.8.0_66libjvm66.solibjvm66.so

java 11

Download trava-jdk-11-dcevm for use as jdk11.

java 17/21

Download JetBrainsRuntime for use with jdk17/21.

TIP

If the Apple system prompts that the JDK is damaged or the developer cannot be verified after downloading it, and the JDK cannot be started, enter sudo xattr -r -d com.apple.quarantine /$jdkPath, where $jdkPath is your JDK directory