Part 11 · Fundamentals

Spring Boot: conditional assembly, not sorcery

Prerequisites: 01-ecosystem

Why was an infrastructure bean created?

Classpath: libraries present?; Properties: feature enabled?; Existing beans: user replacement?; Conditions evaluated: create or back off. Connections: Classpath to Conditions evaluated (class conditions); Properties to Conditions evaluated (property conditions); Existing beans to Conditions evaluated (bean conditions)
Conditions vary by auto-configuration. This figure shows the main inputs, not every condition type. [S21] [S02] [S20]

Goal & mental model verified

Boot auto-configuration uses available classes, properties and existing beans to configure infrastructure. User definitions can cause defaults to back off. Starters assemble related dependencies; dependency management aligns versions.

[S21] [S02]

Worked example · design exercise synthesis

Add a database driver and the relevant starter, supply connection properties, and Boot can create infrastructure beans. Define your own DataSource and the matching default may no longer apply.

[S21] [S02] [S20]

Engineering decision synthesis

Keep Boot-managed versions aligned unless an override has a documented reason. Select a supported runtime and build tool for your chosen generation.

[S21] [S02] [S20]

Pitfall & diagnosis synthesis

A starter can activate unexpected configuration. Mixing individual Spring versions may produce linkage errors. A bean declared too broadly can accidentally replace a useful default.

[S21] [S02] [S20]

Improve & validate synthesis

Use the condition evaluation report to understand why configuration matched or failed. Record custom overrides and test upgrades against startup and representative paths.

[S21] [S02] [S20]
Keep this: Auto-configuration is conditional code you can inspect.
Check yourself: Does adding a starter guarantee a working database?

No. Driver, credentials, reachable infrastructure and matching configuration still matter.

Sources & further reading

  1. [S02] Spring Boot system requirements

    Spring project maintainers · documentation · accessed 2026-10-09 · Spring Boot 4.1.1

    Supports: Boot 4.1.1 requires Java 17+ and Framework 7.0.9+; Supported Java range and build tools

    Read the linked section to validate the mechanism and its version-specific constraints.

  2. [S20] Bean and Configuration

    Spring project maintainers · documentation · accessed 2026-10-09 · Documentation retrieved 2026-10-09

    Supports: Java bean definitions; Configuration classes

    Read the linked section to validate the mechanism and its version-specific constraints.

  3. [S21] Boot auto-configuration

    Spring project maintainers · documentation · accessed 2026-10-09 · Documentation retrieved 2026-10-09

    Supports: Conditional configuration; User beans can replace defaults

    Read the linked section to validate the mechanism and its version-specific constraints.