Intellij IDEA – Spring boot reload static file is not working
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 :
<!-- 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.
If the static files are not reloaded, press CTRL+F9 to force a reload.