The Starters You Will Use Most
A new Spring Boot project on start.spring.io offers well over a hundred dependencies to tick. Most services use the same handful. Knowing those few by heart, and what each one switches on, lets you read any project's build file and guess its architecture in seconds.
The rule
Read a build file's starters and you know what the app does.
Here is library-service's pom.xml, trimmed to its starters:
<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency>
<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-validation</artifactId></dependency>
<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-data-jpa</artifactId></dependency>
<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-security</artifactId></dependency>
<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-actuator</artifactId></dependency>
<dependency><groupId>org.postgresql</groupId><artifactId>postgresql</artifactId><scope>runtime</scope></dependency>
<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-test</artifactId><scope>test</scope></dependency>| Starter | What it switches on |
|---|---|
web |
Spring MVC, Jackson, embedded Tomcat: blocking REST APIs |
webflux |
Reactive web on Netty: non-blocking APIs |
validation |
Bean Validation annotations such as @NotBlank and @Email |
data-jpa |
Spring Data repositories plus Hibernate, talking to a SQL database |
data-jdbc / jdbc |
Simpler SQL access without a full ORM |
data-mongodb |
Repositories for MongoDB documents |
security |
The security filter chain, locked down by default |
oauth2-resource-server |
Accepting and checking bearer tokens |
actuator |
Health, metrics and other production endpoints |
test |
JUnit 5, Mockito, AssertJ and Spring's test support |
Notice that a starter such as data-jpa does not include a database driver. You add the driver for your database (postgresql above), usually with runtime scope because your code never calls it directly.
The shortcut
Read starters in layers, from the outside of the app inward: how requests arrive (web or webflux) → how they are protected (security, oauth2) → where data lives (data-*, driver) → how it is operated (actuator) → how it is tested (test).
Requests
web: a blocking REST API on Tomcat, withvalidationchecking input.
A common mistake is adding both web and webflux without meaning to. When both are present, Boot runs a classic servlet (MVC) app, so the reactive stack is dead weight. Pick the one that matches how you write controllers.
Drills
Answer fast — trust the rule.
Which starter brings JUnit 5, Mockito and AssertJ?
A build file has data-jpa but no database driver. What is missing for PostgreSQL?
Which starter should you add to check that a new book's title is not blank?
A project's starters are webflux, data-mongodb and actuator. What kind of app is it most likely?
Remember
- Read a build file's starters and you know what the app does.
- Read in layers: requests, protection, data, operations, tests.
- Trap: data starters need a driver, and
webpluswebfluxtogether gives you plain MVC.
