liveBook · Manning

Automatic application restart

As explained in Spring in Action, Sixth Edition

Automatic application restart is a development feature that restarts an application when project code or configuration changes are detected.

Automatic application restart shortens the development feedback loop. With Spring Boot DevTools active, changes to Java code or properties files trigger a restart after a brief delay, so updated behavior becomes visible without manually stopping and launching the application. section 1.3.5

DevTools makes the restart faster and limits what must be reloaded:

  • It monitors project files, including content under src/main/, for changes. section 1.3.5
  • It loads project code and dependency libraries through separate JVM class loaders. section 1.3.5
  • When project code changes, it reloads the project class loader and restarts the Spring application context while retaining the dependency loader and JVM. section 1.3.5
  • Dependency changes are not included in these automatic restarts and require a different restart path. section 1.3.5

Editing a project file

Change a Java class or properties file, wait briefly, and continue testing the running application after DevTools restarts the Spring application context. The JVM and unchanged dependency libraries remain available. section 1.3.5

How Spring in Action, Sixth Edition covers it

How deep it goes
Explains monitoring, two JVM class loaders, selective reloading, context restart, and the dependency-change limitation.
Examples
Uses edits to Java code and properties files as triggers for an automatic application restart.
What it assumes
Assumes a Spring project with DevTools active and explains its JVM reload behavior without requiring a specific IDE.
What you can do after
Operate DevTools to iterate on project code and configuration with shorter restart times.
How it connects
Connects Spring Boot DevTools with the JVM, class loaders, dependency libraries, and the Spring application context.

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.