DEV Community

Cover image for ⚡ I Was Restarting Spring Boot Again and Again… Until I Found DevTools
Shashwath S H
Shashwath S H

Posted on

⚡ I Was Restarting Spring Boot Again and Again… Until I Found DevTools

When I started learning Spring Boot, I thought restarting the server was normal.

Change code ✅
Stop server ❌
Start again ✅
Wait… 😴
Repeat 🔁

At first it was fine.
But once the project grew, restarting again and again became painful.

That’s when I discovered Spring Boot DevTools — and it instantly made development faster.


🧠 What is Spring Boot DevTools?

Spring Boot DevTools is a development-time dependency that improves productivity by enabling features like:

Automatic restart
✅ Faster feedback loop
✅ Better developer experience

It’s meant only for development, not production.


✅ Step 1: Add the DevTools Dependency

In Maven (pom.xml), add:

<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-devtools</artifactId>
  <optional>true</optional>
</dependency>
Enter fullscreen mode Exit fullscreen mode

After adding this, Spring Boot can detect classpath changes and restart automatically.


🔄 The Best Feature: Automatic Restart

DevTools automatically restarts your application when files on the classpath change.

Why this is useful:

  • It’s faster than a full restart
  • Only changed parts get reloaded
  • Development becomes smoother

🧩 How DevTools Restart Works Internally (Simple Explanation)

DevTools uses two class loaders:

✅ One for base classes that don’t change (libraries, dependencies)
✅ One for application classes that change (your code)

So when you change your code:

  • Only your application class loader reloads
  • Restart happens faster

This is why it feels quick and lightweight.


⚙️ IntelliJ Setting (Important)

After adding DevTools, you may need to update IntelliJ settings to allow restart properly during development.

This step matters because sometimes IntelliJ doesn’t trigger automatic reload unless configured.


🛠️ Useful DevTools Configurations

You can control DevTools behavior using application.properties.

✅ Disable restart (if needed)

spring.devtools.restart.enabled=false
Enter fullscreen mode Exit fullscreen mode

✅ Exclude folders from restart

spring.devtools.restart.exclude=static/**,public/**
Enter fullscreen mode Exit fullscreen mode

Useful when you don’t want restart triggers for static content.


✅ Poll interval

spring.devtools.restart.pollInterval=20
Enter fullscreen mode Exit fullscreen mode

Defines how often DevTools checks for changes.


✅ Quiet period

spring.devtools.restart.quietPeriod=10
Enter fullscreen mode Exit fullscreen mode

Wait time before restarting after changes are detected.


🚀 Final Thoughts

Spring Boot DevTools is one of those small features that makes a huge difference.

If you're tired of:

  • restarting again and again
  • losing time during development
  • slow feedback while learning

DevTools is a must-have for Spring Boot development.

This post is part of my learning-in-public journey while exploring Spring Boot and real-world backend development.

Do you still restart Spring Boot manually or are you using DevTools?

Top comments (0)