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 (2)

Collapse
 
nabilanam profile image
Nabil Anam • Edited

For future visitors: In newer ide the specified registry option is missing. Instead check the Allow auto-make to start even if developed application is currently running option in Advanced Settings.

Collapse
 
farheen_sk profile image
Farheen Shaikh

Hello, Thanks for the article I was actually seeking help on the same.

I ran into issue as I'm unable to find the property you mentioned.
Image description

@imanuel Would you please let me know if this is due to version of IntelliJ I'm using or something else.

Thanks!