liveBook · Manning

Class loader

As explained in Spring in Action, Sixth Edition

A class loader is a JVM component that loads Java classes and other resources into a running application.

A class loader is a JVM component that loads Java classes and other application resources. Spring Boot DevTools uses separate class loaders to make development restarts faster. section 1.3.5

DevTools divides the running application into two loading areas:

  • One class loader loads project code, property files, and other resources under src/main/, which commonly change during development. section 1.3.5
  • Another class loader loads dependency libraries, which generally change less often. section 1.3.5
  • When project changes are detected, DevTools reloads only the project class loader and restarts the Spring application context while leaving the dependency loader and JVM intact. section 1.3.5

Changing a dependency

Editing Java code or a property file can trigger an automatic restart. Adding, changing, or removing a dependency requires a hard application restart because the dependency class loader is not automatically reloaded. section 1.3.5

How Spring in Action, Sixth Edition covers it

How deep it goes
Explains two class loaders and selective reloading, but stops short of JVM loading internals.
Examples
Uses changed Java code, property files, project resources, and dependency specifications to demonstrate reload behavior.
What it assumes
Assumes familiarity with Java projects, the JVM, and Spring application contexts while explaining class-loader roles directly.
What you can do after
Diagnose why project edits reload automatically while dependency changes require a hard restart.
How it connects
Connects class loaders with the JVM, Spring application context, Spring Boot DevTools, and dependency libraries.

Also explained in

Compare how 2 books explain class loader →

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.