In the development of Spring Boot applications, if you do not want to restart the application repeatedly, you can use Spring Boot’s DevTools tool to implement the Hot Load function. This article show you how to use the Hot Load in IntelliJ IDEA.

Add Dependency

First, we need add the dependency - DevTools in Spring Boot Application.

1
2
3
4
5
6
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
<scope>runtime</scope>
</dependency>

The optional option is to prevent devtools dependencies from being passed to other modules. When a developer packages an app and runs it, devtools is automatically disabled

The runtime option in scope - it set the dependency(package) only works at runtime, not when packaging (prevents the execution of the packaged program online, starts the file listening thread File Watcher, consumes a lot of memory resources)

Launch the hot load feature in IntelliJ IDEA

  1. Settings-compiler-make project automatically

  2. ctrl+shift+alt+/ to activates the Registry dialog box (Mac OS activates the Registry dialog box by double-clicking the shift key)

  3. In the second step of the dialog box, check compiler.automake.allow.when.app.running

TAGS