How to reload changes on Spring Boot without restart server


Situations may occur when you need to speed up your development works without having to worry about restarting the server for every change in the piece of code in your application. Spring Boot provides such provision using which you can easily achieve the goal.

Applications that use spring-boot-devtools will automatically restart whenever files on the classpath change. This can be a useful feature when working in an IDE as it gives a very fast feedback loop for code changes. By default, any entry on the classpath that points to a folder will be monitored for changes.

With this dependency any changes you save, the embedded tomcat will restart. Spring Boot has a Developer tools (devtools) module helps to improve the productivity of developers.


Spring Boot, Spring Boot Devtools, Java at least 8, Eclipse

Reload Code Changes without restarting server

Let’s create Spring Boot project in Eclipse IDE. The name of the project is spring-boot-reload-changes-without-server-restart.

The build.gradle script is given below with the required dependencies for gradle based project:

buildscript {
	ext {
		springBootVersion = '2.2.2.RELEASE'
    repositories {
    dependencies {

plugins {
    id 'java-library'
    id 'org.springframework.boot' version '2.2.2.RELEASE'

sourceCompatibility = 12
targetCompatibility = 12

repositories {

dependencies {

The corresponding pom.xml file is given below for maven based project:

<project xmlns=""





					<source>at least 8</source>
					<target>at least 8</target>

Now we will write main class to start up the Spring Boot application:

package com.roytuts.spring.boot.reload.changes.without.server.restart;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

public class SpringBootChangesWithoutRestartServerApp {

	public static void main(String[] args) {, args);


Now running the above main class will deploy your application and server will be started on port 8080.

Now try to hit the root URL http://localhost:8080 or http://localhost:8080/greet, you will see below output on browser:

reload changes on spring boot without restart server

Next we will add a controller class and scanBasePackages on main class without restarting the server.

Now on every save on your code changes the embedded Tomcat server will be reinitialized automatically.

package com.roytuts.spring.boot.reload.changes.without.server.restart;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

public class GreetController {

	public String greet() {
		return "Welcome";


Add the following line on the main class and replace the @SpringBootApplication annotation.

(scanBasePackages = "com.roytuts.spring.boot.reload.changes.without.server.restart")

Now hitting the URL http://localhost:8080/greet will give you the following output:

reload changes on spring boot without restart server

So we saw how to reload our code changes in Spring Boot application without restarting the server.

Thanks for reading.

One Thought to “How to reload changes on Spring Boot without restart server”

  1. Nice article. it is very helpful for developing application.thanks for sharing this infomation.

Leave a Comment