DEV Community

Cover image for Auto-Reload SpringBoot in IntelliJ IDEA
Emmanuel Ogbinaka
Emmanuel Ogbinaka

Posted on

Auto-Reload SpringBoot in IntelliJ IDEA

Having to click on the Re-run to restart your Springboot application after making changes can get tiring at some point.

Please note, the spring-dev-tools provides this functionality out-of-the-box, but couldn't get to make it work for myself. So, in this post I'll show how I hacked my way around it.

The first step is to add the Spring-dev-tools dependencies to your project pom.xml file within the tag.
NB: This is a key component for this to work

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-devtools</artifactId>
    <scope>runtime</scope>
    <optional>true</optional>
</dependency>
Enter fullscreen mode Exit fullscreen mode

By this I believe your IDE (IntelliJ) is open;
Open the IDE preferences by using the shortcut cmd + , for macs from your keyboard or from the menu bar click on IntelliJ Menu >> Preferences. This will open the Preferences dialog.

IntelliJ IDEA Preferences window

On the left pane, click on the Build, Execution, Deployment option to reveal it's sub-menus. Click on Compiler and on the right check the Build Project Automatically option and click ok;

IntelliJ IDEA Preferences window

Double tap on the Shift key on your keyboard to open IntelliJ search dialog and type registry to open the registry settings.

IntelliJ IDEA search dialog

Find compiler.automake.allow.when.app.running option and check it true; then restart your Spring-boot application and enjoy. Now upon any change in your source code spring restarts the application. Hope you find this helpful, Cheers!

IntelliJ IDEA registry dialog

Top comments (0)