Card 01/ 06

ConceptDifficulty: Intermediate1 min

What a Starter Actually Solves

Adding Spring MVC to a project by hand means picking Spring Web, a JSON library, and a server library, and making sure their versions actually work together — three separate decisions, repeated on every project, and each one a place to get a version wrong.

text
<!-- spring-boot-starter-web instead of this -->
<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>spring-web</artifactId>
  <version>6.1.13</version>
</dependency>
<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>spring-webmvc</artifactId>
  <version>6.1.13</version>
</dependency>
<dependency>
  <groupId>com.fasterxml.jackson.core</groupId>
  <artifactId>jackson-databind</artifactId>
  <version>2.17.2</version>
</dependency>
<dependency>
  <groupId>org.apache.tomcat.embed</groupId>
  <artifactId>tomcat-embed-core</artifactId>
  <version>10.1.30</version>
</dependency>

A starter is a dependency that declares no code of its own — only a curated list of other dependencies, at versions Spring Boot has tested together. spring-boot-starter-web is one line, and it brings in exactly the four things above, at exactly these versions, because Spring Boot's own version management (a BOM) decided them.