- First of all, import Spring Boot
devtools
dependency to pom.xml
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
- Disable cache for template, if you use Freemarker template:
spring:
freemarker:
cache: false
if you use Thymeleaf template:
spring:
thymeleaf:
cache: false
So far, we had turned on the hot reload, but we need manually force reload by press
CTRL + F9
on Windows or *unixCommand + F9
on Mac
- Open Idea, open Prefrences, turn on auto compile.
- Also in Idea IDE, select menu Help -> Find Action, then type
registry
to open Registry settings,
Set compiler.automake.trigger.delay
to 5
(seconds):
After that, the IDE will trigger reload every 5
seconds.
If you want to force reload (compile), you can still press keyboard CTRL + F9
or Command + F9
on Mac;
References: