liveBook · Manning

Convention over configuration

As explained in Spring Start Here, Second Edition

Convention over configuration is a software design approach in which standard conventions supply defaults and explicit configuration is needed only for deviations.

Convention over configuration replaces repeated setup with sensible defaults. Spring Boot applies this approach: it configures common choices for the capabilities an application requests, leaving developers to change only what differs from the convention. section 1.2 section 7.2.3

For example, adding a web dependency signals that the application needs a servlet container. Spring Boot chooses Tomcat by convention, so the application can start with little or no configuration. section 7.2.3

A default web server

A newly started application can show Tomcat running on port 8080. This visible default illustrates the principle: accept the common setup, and configure only when your application needs something different. section 7.2.3

Tomcat started on port(s): 8080 (http) with context path '' #A
Started Main in 1.684 seconds (JVM running for 2.306)

The startup message shows Tomcat running on port 8080 with an empty context path. section 7.2.3

How Spring Start Here, Second Edition covers it

How deep it goes
Defines default configuration and explains dependency-driven Tomcat setup, but does not detail configuration mechanisms for deviations.
Examples
Uses a web dependency to trigger Tomcat configuration and a startup log showing port 8080.
What it assumes
Assumes Java ecosystem familiarity while teaching framework foundations from zero.
What you can do after
Operate/configure a Spring Boot application using defaults and changing only settings that differ from convention.
How it connects
Connects Spring Boot autoconfiguration with dependency starters, servlet containers, and Tomcat.

Also explained in

Compare how 3 books explain convention over configuration →

Related concepts

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