Spring Boot Auto reload | Spring Tips

Spring Boot Auto reload | Spring Tips

Understanding Spring Devtools.

Hello Friends, Today we will understand how spring boot helps us develop our application faster and how it manages application code changes while developing.

Tip : If you are new to Spring Boot, Please visit this link to have better understanding of it.

Spring Boot helps us to create standalone web applications. This application has an inbuilt web server like tomcat. this feature comes with a drawback at development time. every change you make to your code needs a complete restart of the application. This increases you time required to develop the application, Decreasing productivity.

To overcome this problem Spring Boot came up with devtools. Devtools help us to reload the application whenever there is a code change. this avoids all the restarting efforts and thus increases productivity.

Now that we know what devtools do, let's integrate them into our application. If you are using Spring tool suits you can just right-click the application and add Devtools.

Screenshot 2022-07-07 at 8.31.29 PM.png

Or you add the below dependency in pom.xml to add devtools.


Now maven will download the devtools and they will be available in our application.

Now we can start our application. Before we go ahead if you have any problem running the application you can refer to the code on my GitHub.

Once you start the application you can see below logs saying that the application is started and the LiveReload server is running on port 35729.

Screenshot 2022-07-07 at 9.10.05 PM.png

This means our application's live restart is enabled. now any change you do in code will be directly available. But this won't update it in your browser as we don't have any reload component on it. To reload our browsers for every code change we will add a browser extension. Please add this extension available for chrome, edge, and safari.

Now enable the extension and this will add reload functionality.

Screenshot 2022-07-07 at 9.13.27 PM.png

now whenever you change the code it will directly be visible in the browser. works like magic…

This will save lots of time while creating a web application.

Thanks for reading. I hope this story was helpful.

If you are interested, check out my other articles.

you can also visit shubhamdeshmukh.com.

GitHub: github.com/sd2995/SpringBoot/tree/main/Spri..

Did you find this article valuable?

Support Shubham Deshmukh by becoming a sponsor. Any amount is appreciated!