How to use the Hot Load in development of Spring Boot Application

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

本文标题:How to use the Hot Load in development of Spring Boot Application

文章作者:Morning Star

发布时间:2022年01月27日 - 17:01

最后更新:2022年01月27日 - 19:01

原始链接:https://www.mls-tech.info/java/howto-hot-load-in-development-spring-boot-application/

许可协议: 署名-非商业性使用-禁止演绎 4.0 国际 转载请保留原文链接及作者。