Spring Boot Components Hub

← Back to Home

Spring Boot DevTools

Spring Boot DevTools provides developer tools to improve the development experience by enabling automatic application restarts, live reload, and property defaults that enhance productivity during development. It automatically disables itself in production environments.

Key Features

Automatic Restart

Automatically restarts the application when classpath files change, significantly reducing development time.

Live Reload

Browser live reload support when resources change, working with the LiveReload browser extension.

Property Defaults

Development-friendly defaults like disabled template caching and enhanced logging.

Remote Debugging

Remote application support for debugging and monitoring remote Spring Boot applications.

Use Cases

  • Fast Development: Speeding up the development cycle with automatic restarts
  • Frontend Development: Live reloading browser when HTML, CSS, or JavaScript changes
  • Rapid Iteration: Quickly testing code changes without manual restarts
  • Development Environment: Optimizing development experience with sensible defaults
  • Debugging: Enhanced debugging capabilities during development

Example Usage

DevTools automatically detects changes and restarts:

// Make changes to your code
@RestController
public class UserController {
    // Changes here trigger automatic restart
}

Dependencies

Add the following dependency (only in development):

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-devtools</artifactId>
    <scope>runtime</scope>
    <optional>true</optional>
</dependency>

Configuration

Customize restart behavior in application.properties:

spring.devtools.restart.enabled=true
spring.devtools.livereload.enabled=true
spring.devtools.restart.exclude=static/**,public/**

Live Reload

Install the LiveReload browser extension to enable automatic browser refresh when resources change. The extension connects to the embedded LiveReload server on port 35729.