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>
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.
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;
Double tap on the Shift key on your keyboard to open IntelliJ search dialog and type registry
to open the registry settings.
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!
Top comments (2)
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 inAdvanced Settings
.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.
@imanuel Would you please let me know if this is due to version of IntelliJ I'm using or something else.
Thanks!