Spring Boot DevTools on IntelliJ
Published on

Spring Boot DevTools on IntelliJ

Authors

Spring Boot DevTools on IntelliJ

Auto reloading feature does not work out of the box in Intellij. Below are the changes required to make it work correctly.

Spring Boot provide niche feature of hot reloading for a Spring Boot application. It recompile your java application as soon as you make a change. But most important aspect is that it only recompile only those files in which changes are made. Thus process take quite a short time compared to complete application build.

But this feature does not work out of the box in IntelliJ by just adding required dependancy in your application. Below are all the steps required to make auto reload work in IntelliJ.

Add Spring DevTools dependency

pom.xml
<dependency>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-devtools</artifactId>
   <scope>runtime</scope>
</dependency>

Changes in IntelliJ build configuration

Go to Settings -> Build, Execution, Deployment -> Compilerand then enable build project automatically

/static/images/posts/2022/spring-boot/build-project-auto.webp

Next goto Settings -> Advanced Settings and then enable "Allow auto-make to start even if developed application is currently running"

/static/images/posts/2022/spring-boot/allow-auto-make.webp

That's all. Whenever you make a change in your application it will be recompiled automatically.