Intellij IDEA – Spring boot reload static file is not working
By:Roy.LiuLast updated:2019-08-11
In Eclipse, just include the Spring Boot Dev Tools dependency, then the hot swapping and static file reload will be enabled magically. For Intellij IDE, we need extra steps to enable it.
1. Spring Boot Dev Tools
With Spring Boot Dev Tools enabled :
- Any changes to views or resources can be seen in the browser directly, no need restarts, just refresh the browser.
- Any changes to the code that will restart the Spring container automatically.
First, include the Spring Boot Dev Tools dependency :
pom.xml
<!-- hot swapping, enable live reload --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <optional>true</optional> </dependency>
2. Build Project Automatically
File –> Setting –> Build, Execution, Deployment –> Compiler –> check this Build project automatically
3. Intellij Registry
3.1 Press SHIFT+CTRL+A (Win/*nix) or Command+SHIFT+A (Mac) to open a pop-up windows, type registry
3.2 Find and enabled this option compiler.automake.allow.when.app.running
Done. Now, the hot swapping & static files auto reload should be enabled.
In Menu -> Build -> Build Project (CTRL + F9)
If the static files are not reloaded, press CTRL+F9 to force a reload.
If the static files are not reloaded, press CTRL+F9 to force a reload.
From:一号门
Previous:iText Read and Write PDF in Java
COMMENTS