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-toolsprovides 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.
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!