This article shows you how to enable Spring boot hot swapping in Intellij IDE.

Spring Boot Dev Tools

  1. Any changes to views or resources can be seen in the browser directly, no need restart, just refresh the browser.
  2. Any changes to the code that will restart the Spring container automatically.

1. Spring Boot Dev Tools

Include the following Spring Boot Dev Tools dependency :

pom.xml

  <!-- hot swapping, disable cache for template, enable live reload -->
  <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-devtools</artifactId>
      <optional>true</optional>
  </dependency>

In Eclipse, just include the above “Spring Boot Dev Tools” dependency, then the template reload and hot swapping will work, for Intellij IDE, you need extra steps to enable it.

2. Build Project Automatically

File –> Setting –> Build, Execution, Deployment –> Compiler –> check this Build project automatically

ideaj-spring-boot-dev-tools

3. Intellij Registry

3.1 Press SHIFT+CTRL+A (Win/Lin) or Command+CTRL+A (Mac) to open a pop-up windows, type registry

ideaj-spring-boot-dev-tools-1

3.1 Find and check this option compiler.automake.allow.when.app.running

ideaj-spring-boot-dev-tools-2

Done.

References

  1. Spring Boot Dev Tools