Hot Swapping in Spring Boot with Eclipse STS

In web application developing, hot swapping means that you can modify the source code and see the changes immediately, simply by reloading the page in the web browser, without rebuilding your project and have to restart the web server.

Some java web frameworks are ready with it, Play Framework is a good example, whereas using Spring Boot you have to do a little work.

In the following is shown how to obtain the hot swapping in a Spring Boot web application, using Eclipse STS and Thymeleaf as template engine.

1. Get spring-loaded to handle the java code

You can download spring-loaded 1.2.0 from here:


or check here for the last version:

2. Add spring-loaded in Eclipse STS

Open Eclipse→ Right click on your project (your Spring Boot web app) → Run AsSpring Boot (launch the application at least one time as Spring Boot application).

Right click on your project→ Run As → Run Configurations…Java Application<project_name>Arguments

Inside the text box VM Arguments append the spring-loaded option:

 -javaagent:/<path-to>/springloaded-1.2.0.RELEASE.jar -noverify

where <path-to> is the directory path where you have the spring-loaded jar file.

Then click Apply Run.

Now you can try to modify some java code and see the changes reloading the web page.

3. Configure Thymeleaf

Open the file and add the following line:

spring.thymeleaf.cache: false

This option disables the cache for thymeleaf, allowing you to modify thymeleaf pages and just reloading the page in the web browser to see the changes.



  • Thanks Coderpills. I’m working through the securing-web sample boot application. I can now see that the changed classes are swapped out by spring-loaded. When I change the username/password combination, the application continues to use the previous username/password. I wonder whether this is because the authentication is ‘in memory’, and the values are loaded by the init() method when the application is started. And spring-loaded does not reload the application context. Any thoughts?

    Otherwise, I would be curious to hear why spring-loaded is not included with spring-boot out of the box?

    • Yes, any changes to code that is executed at startup (as the loading of username/password in your case) need an application restart to become effective. Perhaps a way to solve your problem can be to create an implementation of ReloadEventProcessorPlugin as suggested in the spring-loaded documentation here: Keep us updated if you find a solution.

  • Kevin

    Thanks Netgloo.always smart

  • zulkarnainshah

    Error opening zip file or JAR manifest missing : /Downloads/springloaded-1.2.0.RELEASE.jar


Category BootstrapCategory CoffeescriptCategory DrupalCategory GravCategory HTMLCategory JavascriptCategory JoomlaCategory jQueryCategory LaravelCategory MagentoCategory PHPCategory SharePointCategory SpringCategory ThymeleafCategory WordPressCategory Workflow


Developed and designed by Netgloo
© 2019 Netgloo