Spring Boot with Auto Update Changed Files – Example

You just want to see an minimal example of Spring boot and how to make it auto updates files which are changed.

This page is for you.

This example is a part of  Spring Boot with all examples

Full Code with Spring Boot 1.5.8.RELEASE:

6_spring-boot-auto-update-changes.zip

What you need for run this:

  • Maven 3
  • Java 8

What the code will do:

  • [Not the point] Call an url  then the service will call a JSP file which has JSTL tag
  • When you change the JSP files or static files, the Spring Boot will update the change
  • When you change the java file and compile, the Spring Boot will update the change

Explain:

This is the file structure:

Most of the class is the same as Spring Boot with JSP example . I will not explain it here.

You just have to add this dependency in pom.xml :

Try:

run this in console:

Then run this to start:

Open a browser and try to go to this url:

Then you should see this:

Try to change testjsp-view.jsp and go to the url again, you will see the change instantly.

Go to this url:

Try to change staticfile.txt and go to the url again, you will see the change instantly.

Try to change java class, for example, TestController.java. But Spring Boot will not see the change in java file, it will see the change in class file. So, you need to recompile the file. In IntelliJ, you can just shift + F9.