liveBook · Manning

Spring Boot DevTools

As explained in Spring in Action, Sixth Edition

Spring Boot DevTools is a Spring Boot development-time library that provides automatic restart, browser refresh, template-cache disabling, and related development features.

Spring Boot DevTools is a development-time library that shortens the edit-run-test cycle for Spring applications. It watches project changes, restarts the application when Java code or properties change, refreshes browser resources, disables template caches, and can provide an H2 Console when H2 is in use. section 1.3.4 section 1.3.5

DevTools provides several practical development conveniences:

  • Restarts the application after changes to Java code or properties files. section 1.3.5
  • Refreshes browser-destined resources such as templates, JavaScript, and stylesheets when they change. section 1.3.5
  • Disables template caching during development, making edited views visible without manually changing every template engine property. section 2.5.1
  • Works independently of the IDE and disables itself when the application is deployed for production. section 1.3.5

A faster edit-and-test loop

Run the Spring application, change a controller, property, or template, and return to the browser after a brief delay. DevTools reloads the class loader containing project code, restarts the Spring application context, and leaves dependency libraries and the JVM intact. Template caching is disabled during development; deployment disables DevTools and restores template caching. section 1.3.5 section 2.5.1

Table 2.3 Properties to enable/disable template caching (view table figure)

Template

Cache-enable property

FreeMarker

spring.freemarker.cache

Groovy templates

spring.groovy.template.cache

Mustache

spring.mustache.cache

Thymeleaf

spring.thymeleaf.cache

Use the template-cache table to identify the cache property associated with FreeMarker, Groovy templates, Mustache, or Thymeleaf when explicit configuration is needed. section 2.5.1

How Spring in Action, Sixth Edition covers it

How deep it goes
Explains automatic restart through two JVM class loaders and application-context restart, while deferring detailed deployment behavior.
Examples
Demonstrates changes to Java code, properties, templates, JavaScript, stylesheets, and H2-backed applications.
What it assumes
Assumes a Spring Boot project and requires no specific IDE, while introducing DevTools as a selected project dependency.
What you can do after
Apply it via Spring Boot to shorten feedback cycles while developing code, configuration, and server-rendered web resources.
How it connects
Connects Spring Boot development with the JVM, class loaders, application context, template engines, and H2 Console.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Spring in Action, Sixth Edition. The section links point to the parts of the book it draws on.