- Chapter
- Chapter 2 — Spring Boot Starters
- Prerequisites
- Chapter 1
- You will be able to
- Explain what a starter is, inspect what it brings, relate starters to the BOM, and design starters for your own organisation
- Covers
- Dependency Aggregation · Consistent Dependency Versions
On this page
- 1. Concept / Definition
- 2. Why It Exists
- 3. Core Concepts
- 4. How It Works Internally
- 4A. Deep Dive — Designing Internal Starters
- 5. APIs / Features / Syntax
- 6. Practical Examples
- 7. Common Problems & Mistakes
- 8. Performance & Production Considerations
- 9. Architecture & Design Considerations
- 10. Interview Questions & Answers
1Concept / Definition
A starter is a dependency descriptor — a POM with no code — that aggregates the libraries needed for one capability. Declaring a single starter brings a tested set of transitive dependencies, including the Boot module that auto-configures them. Versions are not specified in the starter declaration; they come from Boot's bill of materials (BOM), which guarantees a consistent combination.

<!-- Without a version: managed by the Spring Boot BOM -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webmvc</artifactId>
</dependency>| Property of a starter | Meaning |
|---|---|
| No Java code | Only a list of dependencies (and sometimes exclusions) |
| Capability-oriented | One starter per technology or feature (web MVC, JPA, Kafka…) |
| Transitive | Brings libraries, the Boot core starter and the technology's auto-configuration module |
| Versionless in your build | Versions inherited from the Boot BOM |
| Paired with a test starter (Boot 4) | spring-boot-starter-<tech>-test provides the testing support |
2Why It Exists
Before starters, adopting a capability such as JPA meant finding the right artefacts (Hibernate core, the JPA API, a connection pool, Spring ORM, Spring Data), choosing versions that worked together and repeating the exercise in every project. Starters encode that knowledge once. They also act as the switch for Boot's auto-configuration: because each auto-configuration is guarded by classpath conditions, putting the starter's libraries on the classpath is what enables the corresponding beans.

3Core Concepts
3.1 Dependency aggregation
$ mvn dependency:tree -Dincludes=org.springframework*,org.hibernate*,com.zaxxer
[INFO] com.acme:orders:jar:1.0
[INFO] \- org.springframework.boot:spring-boot-starter-data-jpa:jar:4.0.0
[INFO] +- org.springframework.boot:spring-boot-starter-jdbc:jar:4.0.0
[INFO] | +- org.springframework.boot:spring-boot-jdbc:jar:4.0.0
[INFO] | \- com.zaxxer:HikariCP:jar:…
[INFO] +- org.springframework.boot:spring-boot-data-jpa:jar:4.0.0
[INFO] +- org.hibernate.orm:hibernate-core:jar:7.x
[INFO] \- org.springframework.data:spring-data-jpa:jar:4.x
| Layer inside the tree | Example for Data JPA |
|---|---|
| Core starter | spring-boot-starter (Boot core, logging, YAML support) |
| Other starters reused | spring-boot-starter-jdbc (DataSource, HikariCP) |
| Boot technology module | spring-boot-data-jpa — auto-configuration and support classes |
| Libraries | Hibernate ORM 7, Spring Data JPA, Jakarta Persistence API |
Starters compose: higher-level starters depend on lower-level ones rather than repeating their contents. This keeps each technology's dependency list in one place.
3.2 Consistent dependency versions

The versions of everything a starter brings — Spring projects and third-party libraries — are defined in spring-boot-dependencies. Your build imports that BOM (via spring-boot-starter-parent, dependencyManagement import, or the Gradle plugin/platform), and declares starters without versions. The effect:
| Without BOM alignment | With BOM alignment |
|---|---|
| Each project chooses versions independently | All projects on Boot 4.0.x use the same versions |
| Transitive dependencies may disagree | Managed versions override transitive ones |
| Upgrades require per-library research | Upgrading Boot upgrades a tested combination |
Runtime errors like NoSuchMethodError | Combinations integration-tested by the Boot team |
4How It Works Internally
1. A starter POM declares its dependencies with versions inherited from spring-boot-dependencies (the starter itself is part of the Boot release).
2. Your build resolves the starter; its transitive dependencies are added to the classpath.
3. Where your build imports the Boot BOM, managed versions override the versions requested by transitive dependencies (Maven dependencyManagement semantics; Gradle platform constraints).
4. At runtime, auto-configuration classes in the technology module check for classes (@ConditionalOnClass) that the starter made available and create beans accordingly.
| Boot 4 naming convention | Pattern | Example |
|---|---|---|
| Technology module | spring-boot-<technology> | spring-boot-kafka |
| Root package | org.springframework.boot.<technology> | org.springframework.boot.kafka |
| Starter | spring-boot-starter-<technology> | spring-boot-starter-kafka |
| Test starter | spring-boot-starter-<technology>-test | spring-boot-starter-kafka-test |
4ADeep Dive — Designing Internal Starters
Organisations use the same mechanism to encode company standards: an internal starter can bundle approved libraries, a company auto-configuration (logging format, security defaults, tracing headers, error format) and configuration metadata.
| Design rule | Reason |
|---|---|
Name it acme-<feature>-spring-boot-starter | The spring-boot-starter-* prefix is reserved for Spring Boot |
Keep code in a separate -autoconfigure module | Starter stays a pure dependency list; auto-config can be used alone |
| Do not pin versions managed by the Boot BOM | Let the application's Boot version decide; avoid conflicts |
| Depend on the minimum set of libraries | Every dependency activates auto-configuration somewhere |
Mark optional integrations optional | Consumers opt in by adding the library themselves |
| Version it with a compatibility matrix | "acme-platform 5.x supports Boot 4.0.x" |
<!-- acme-observability-spring-boot-starter/pom.xml -->
<dependencies>
<dependency>
<groupId>com.acme.platform</groupId>
<artifactId>acme-observability-spring-boot-autoconfigure</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId> <!-- no version: BOM -->
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-tracing-bridge-otel</artifactId>
</dependency>
</dependencies>5APIs / Features / Syntax
| Artefact / tool | Purpose |
|---|---|
spring-boot-starter | Core starter: Boot, auto-configuration support, logging, YAML |
spring-boot-starter-<technology> | Capability starters |
spring-boot-starter-<technology>-test | Test companions (bring spring-boot-starter-test) |
spring-boot-starter-classic / -test-classic | Boot 4 migration aid: all modules, like Boot 3 |
spring-boot-dependencies | The BOM |
mvn dependency:tree, gradle dependencies | Inspect what a starter brings |
| start.spring.io | Generate projects with chosen starters |
6Practical Examples
6.1 Gradle with the Boot plugin
plugins {
java
id("org.springframework.boot") version "4.0.0"
id("io.spring.dependency-management") version "1.1.7"
}
dependencies {
implementation("org.springframework.boot:spring-boot-starter-webmvc")
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
runtimeOnly("org.postgresql:postgresql")
testImplementation("org.springframework.boot:spring-boot-starter-webmvc-test")
testImplementation("org.springframework.boot:spring-boot-starter-data-jpa-test")
}6.2 Swapping a transitive choice: Jetty instead of Tomcat
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webmvc</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jetty</artifactId>
</dependency>6.3 Finding which starter brought a library
$ ./gradlew dependencyInsight --dependency HikariCP --configuration runtimeClasspath
com.zaxxer:HikariCP:… (selected by rule)
\--- org.springframework.boot:spring-boot-starter-jdbc:4.0.0
\--- org.springframework.boot:spring-boot-starter-data-jpa:4.0.06.4 Starter checklist for a new service
| Question | Typical answer |
|---|---|
| HTTP API? | -webmvc (blocking) or -webflux (reactive) |
| Relational data? | -data-jpa or -data-jdbc / -jdbc, plus -flyway or -liquibase |
| Security? | -security, -security-oauth2-resource-server for JWT APIs |
| Input validation? | -validation |
| Operations? | -actuator (+ -opentelemetry / -micrometer-metrics as needed) |
| Messaging? | -kafka, -amqp or -jms |
| Tests? | The -test companion of each starter used |
6.5 Boot 4 classic starters as a migration bridge
<!-- Temporary: restores a Boot 3-like classpath with all auto-configuration modules -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-classic</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test-classic</artifactId>
<scope>test</scope>
</dependency>| Phase | Build contents | Goal |
|---|---|---|
| 1 — Bridge | Classic starters + existing third-party dependencies | Compile and run on Boot 4; fix imports and API changes |
| 2 — Identify | Remove classic starters; follow compilation and start-up failures | Discover which technology starters are really needed |
| 3 — Modular | Explicit technology starters and test companions | Minimal, visible, supportable classpath |
The classic starters provide all modules but not their third-party libraries, so the application still needs its existing library dependencies. They are a stepping stone, not a destination.
6.6 Starters versus direct module dependencies
| Declare… | You get | Use when |
|---|---|---|
spring-boot-starter-data-jpa | Boot module + Hibernate + Spring Data + HikariCP + core starter | Normal applications |
spring-boot-data-jpa (module only) | Auto-configuration only; you choose libraries | Unusual stacks (different pool or provider versions) |
| Raw libraries only | No auto-configuration module | Plain Framework usage or libraries |
7Common Problems & Mistakes
- Adding versions to starters. Overrides the BOM for that artefact only, creating mismatches.
- Adding raw libraries instead of starters (e.g.
hibernate-core) and wondering why auto-configuration or managed versions are missing. - Unused starters activating unwanted auto-configuration (e.g. a DataSource required at start-up).
- Forgetting test starters in Boot 4 — test slices or security test support not working.
- Using spring-boot-starter-*
names for internal starters: that prefix is reserved for official Spring Boot starters, so name yours acme-spring-boot-starter. - Leaving the classic starter in place after a Boot 4 migration, hiding real dependencies.
Most of these mistakes come from treating the build file as a shopping list rather than as configuration. Every starter on the classpath can switch on auto-configuration, so a forgotten spring-boot-starter-data-jpa makes an otherwise stateless service fail at start-up because no DataSource URL is set, while a raw hibernate-core dependency gives you the library without the Boot module that configures it. Pinning a version on one artefact breaks the BOM's guarantee for that family only, which is why the result is a NoSuchMethodError in a rarely used path rather than a build failure. Internal starters must use a company prefix, such as acme-observability-spring-boot-starter, because the spring-boot-starter- prefix belongs to the Boot project. A quick review of mvn dependency:tree and the conditions report after every dependency change catches most of these problems before they reach production.
8Performance & Production Considerations
| Concern | Guidance |
|---|---|
| Image size | Every starter adds jars; remove unused ones to shrink images and CVE surface |
| Start-up time | Fewer auto-configurations to evaluate and fewer beans to create |
| Security scanning | Starters make transitive dependencies explicit in SBOMs; review them |
| Upgrade effort | Starter-based builds upgrade cleanly with the Boot version |
9Architecture & Design Considerations
- Starters are the unit of technology adoption. Governance ("approved technologies") maps naturally to approved starters.
- Internal starters encode platform standards and distribute them through dependency upgrades instead of documentation.
- Keep services' starter sets minimal and intentional; review them like architecture decisions.
- Boot 4's per-technology modules make dependencies visible — use that visibility in reviews and SBOMs.
10Interview Questions & Answers
What is a Spring Boot starter?
A starter is a dependency descriptor, essentially a POM with no Java code, that aggregates everything needed for one capability. Declaring spring-boot-starter-data-jpa, for example, brings the core starter with logging and YAML support, the JDBC starter with HikariCP, Hibernate ORM, Spring Data JPA, the Jakarta Persistence API and, in Boot 4, the spring-boot-data-jpa module that holds the auto-configuration. You declare it without a version, because versions come from the Boot BOM. Starters compose, so higher-level starters reuse lower-level ones rather than repeating their contents. The practical meaning is a compatibility promise: these libraries, at these versions, are tested together and configured by Boot when they appear on the classpath.
Why don't you specify versions for starters?
Because the version is already decided by the Spring Boot BOM, spring-boot-dependencies, which your build imports through spring-boot-starter-parent, a dependencyManagement import or the Gradle plugin. The BOM defines the version of every starter and of the libraries they bring, Spring projects and third-party ones such as Jackson, Hibernate and Tomcat, and the Boot team tests that combination together. Leaving versions out means upgrading Boot upgrades the whole set in one step, and Maven's dependencyManagement or Gradle's platform constraints also override conflicting transitive versions. Adding a version to one starter or library breaks that guarantee for that artefact only, which is how NoSuchMethodError and ClassNotFoundException appear at runtime in builds that compile cleanly.
How do starters relate to auto-configuration?
Starters decide what is on the classpath, and auto-configuration decides what to do about it. A starter adds the libraries plus, in Boot 4, the technology module such as spring-boot-kafka that contains the auto-configuration classes. At start-up Boot loads the auto-configuration candidates listed in each module's AutoConfiguration.imports file and evaluates their conditions: @ConditionalOnClass checks that the library is present, @ConditionalOnProperty checks settings, and @ConditionalOnMissingBean backs off if you defined your own bean. When the conditions match, the beans are created, such as a KafkaTemplate. So adding a starter effectively switches a capability on, and removing it switches the capability off, which is why starters should be chosen deliberately.
What changed about starters in Spring Boot 4?
Boot 4 modularised the code base. Instead of one large spring-boot-autoconfigure JAR, each technology has its own module, such as spring-boot-kafka with the root package org.springframework.boot.kafka, its own starter and a matching test starter, such as spring-boot-starter-kafka-test, that provides test slices and support. Several starters were renamed to match, most visibly spring-boot-starter-web becoming spring-boot-starter-webmvc. The effect is that the classpath now shows exactly which technologies a service uses, and unused auto-configuration is never loaded. For migration, spring-boot-starter-classic and spring-boot-starter-test-classic restore a Boot 3-like set of all modules, but they are a temporary bridge, not something to keep.
How do you replace Tomcat with Jetty in a Boot web application?
Exclude spring-boot-starter-tomcat from the web starter and add spring-boot-starter-jetty, as in the example in section 6.2. The web starter depends on the Tomcat starter by default, so the exclusion removes embedded Tomcat from the classpath, and the Jetty starter adds Jetty's server and servlet modules. At start-up the servlet web server auto-configuration evaluates its conditions, finds the Jetty classes rather than Tomcat's, and creates a JettyServletWebServerFactory, so nothing changes in application code. Properties under server.* keep working, and server.jetty.* exposes Jetty-specific tuning. Check with mvn dependency:tree that no other dependency brings Tomcat back transitively, and remember that Boot 4 no longer supports Undertow, so Tomcat and Jetty are the servlet choices.
What happens if you add an explicit version to a managed dependency?
Your version wins for that artefact only, while its siblings stay on the BOM's version. Many libraries are released as families that must match, such as Jackson modules, Hibernate artefacts or Netty components, so overriding hibernate-core but not the related Hibernate modules, or one Jackson module but not jackson-databind, gives a mixed set. The build compiles because each JAR resolves, but at runtime you get NoSuchMethodError, ClassNotFoundException or subtle behaviour changes, often only on rarely used paths. The safe way to override is the BOM's version property, for example a hibernate.version property in Maven or the equivalent extra property in Gradle, which moves the whole family together, and to document why the override exists.
How would you design an internal starter for company observability standards?
I would follow Boot's own structure. An acme-observability-spring-boot-autoconfigure module holds the @AutoConfiguration classes, listed in META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports, plus @ConfigurationProperties under an acme.observability prefix, with every bean guarded by @ConditionalOnClass, @ConditionalOnProperty and @ConditionalOnMissingBean so services can override it. It configures the company log format, trace propagation, common metric tags and error format. A separate acme-observability-spring-boot-starter is a pure dependency list: the autoconfigure module, the actuator starter and the OpenTelemetry bridge, with no versions for Boot-managed libraries. I would generate configuration metadata for IDE support, test with ApplicationContextRunner, and publish a compatibility matrix, such as platform 5.x for Boot 4.0.x.
How can starters support technology governance across many teams?
By making starters the unit of technology adoption. The architecture board publishes an approved list expressed as starters: standard Boot starters that are allowed, ones that need review, and internal starters that wrap capabilities with company defaults, such as security, observability or messaging conventions. Teams adopt a capability by adding a starter, not by assembling libraries, and a platform BOM fixes the Boot version and internal starter versions. CI can then enforce policy, for example by rejecting unapproved starters. Because standards live in code, a security fix or new logging format reaches hundreds of services through a version bump, and architecture reviews can read a service's capabilities from its starter list.
Test your knowledge on this topic →Flashcards from this topic's 8 questions, filtered by level and type.