By WebNest Studio Engineering Team
Spring Boot Tutorial
Spring Boot Starters
Starters are curated dependency descriptors that pull in everything typically needed for a given kind of functionality, with versions that are already tested to work together. Instead of manually choosing compatible versions of Spring MVC, Jackson, an embedded servlet container, and validation libraries, you add one starter and Spring Boot's dependency management resolves a known-good set for you.
This matters because version mismatches between related libraries are one of the most common sources of hard-to-diagnose runtime errors in Java projects. Starters exist specifically to eliminate that class of problem.
Commonly Used Starters
Each starter is named after the capability it adds, following the pattern spring-boot-starter-*.
spring-boot-starter-webmvc— builds RESTful/MVC web applications using Spring MVC, with an embedded Tomcat server and Jackson for JSON (calledspring-boot-starter-webbefore Spring Boot 4).spring-boot-starter-restclient/spring-boot-starter-webclient— HTTP clients for calling other services (separate starters since Spring Boot 4).spring-boot-starter-data-jpa— Spring Data JPA on top of Hibernate, for working with relational databases through repository interfaces.spring-boot-starter-security— Spring Security, adding authentication and authorization with sensible defaults (e.g. every endpoint requires login unless configured otherwise).spring-boot-starter-validation— Bean Validation (Jakarta Validation) support for @Valid-based request validation.spring-boot-starter-test— JUnit 5, Mockito, AssertJ, and Spring Test, all pre-wired for testing (included by default in generated projects).
How Starters Affect the Classpath
Adding a starter to your pom.xml or build.gradle changes what is on the classpath, and that in turn changes what auto-configuration activates. For example, spring-boot-starter-data-jpa brings in Hibernate and the JPA API, which makes classes like EntityManager and DataSource available — and that presence is exactly what Spring Boot's auto-configuration checks for before wiring up a JPA-based persistence layer automatically.
What Changed in Spring Boot 4
Spring Boot 3 shipped one large spring-boot-autoconfigure jar containing the auto-configuration for every supported technology. Spring Boot 4 splits it into small modules, one per technology, and each starter brings in only the module it needs. Applications get a smaller classpath and fewer surprise configurations. Two practical consequences:
- Some starters were renamed.
spring-boot-starter-webstill exists in 4.x but is deprecated in favour ofspring-boot-starter-webmvc. - Every technology starter has a matching test starter, such as
spring-boot-starter-webmvc-testorspring-boot-starter-data-jpa-test, which brings in the test slices for that technology. - When upgrading a large Boot 3 application,
spring-boot-starter-classicandspring-boot-starter-test-classicbring back the full set of auto-configuration modules. They are a stepping stone for migration; move to the specific starters afterwards.
Seeing What a Starter Brings In
A starter is just a POM with dependencies, so you can inspect it. mvn dependency:tree (or gradle dependencies) prints every library and its version. Use it when you need to know which Tomcat, Hibernate or Jackson version you are actually running, or when two libraries pull in conflicting versions of the same dependency. The versions come from the spring-boot-dependencies BOM, which is why you normally write no <version> for anything Spring Boot manages.
Choosing Starters for a Typical Project
- REST API with a SQL database: webmvc, data-jpa, validation, the JDBC driver (such as
org.postgresql:postgresql), and actuator for health checks. - Add login or JWT: security, or security-oauth2-resource-server for an API that accepts tokens.
- Calling other services: restclient for blocking calls, webclient for reactive ones.
- Only what you use: every extra starter adds startup work, attack surface and auto-configuration to understand, so remove the ones a project no longer needs.
Examples
Declaring starters in a Maven pom.xml
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webmvc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
</dependencies>
(No console output — this changes the resolved dependency tree; run "mvn dependency:tree" to confirm Tomcat, Jackson, Hibernate, and HikariCP are now present.)
What four starters actually resolve to (mvn dependency:tree, Spring Boot 4.1.1, trimmed)
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>4.1.1</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webmvc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</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>
</dependencies>
$ mvn dependency:tree -Dscope=compile
+- org.springframework.boot:spring-boot-starter-webmvc:jar:4.1.1:compile
| | +- org.springframework.boot:spring-boot-starter-logging:jar:4.1.1:compile
| | | +- ch.qos.logback:logback-classic:jar:1.5.38:compile
| | \- tools.jackson.core:jackson-databind:jar:3.1.5:compile
| | | +- org.apache.tomcat.embed:tomcat-embed-core:jar:11.0.24:compile
| \- org.springframework:spring-webmvc:jar:7.0.9:compile
+- org.springframework.boot:spring-boot-starter-actuator:jar:4.1.1:compile
| \- io.micrometer:micrometer-core:jar:1.17.1:compile
+- org.springframework.boot:spring-boot-starter-validation:jar:4.1.1:compile
| \- org.hibernate.validator:hibernate-validator:jar:9.1.3.Final:compile
\- org.springframework.boot:spring-boot-starter-data-jpa:jar:4.1.1:compile
| \- com.zaxxer:HikariCP:jar:7.0.2:compile
| | +- org.hibernate.orm:hibernate-core:jar:7.4.5.Final:compile
(No versions were written in the POM; the parent's BOM chose all of them.)
Common Mistakes
- Following a Spring Boot 3 tutorial in a Boot 4 project and adding spring-boot-starter-web. It still works but is deprecated; use spring-boot-starter-webmvc.
- Adding a test dependency such as @WebMvcTest support without the matching test starter (spring-boot-starter-webmvc-test), so the test slice annotations cannot be found.
- Manually specifying versions for individual libraries already managed by a starter, which can reintroduce the version-conflict problems starters are designed to avoid.
- Adding spring-boot-starter-security "just in case" and being surprised every endpoint suddenly returns 401 Unauthorized — the starter enables security by default the moment it is on the classpath.
- Forgetting that starters are transitive — removing a starter can silently remove auto-configuration you were relying on elsewhere.
Exercise
Using the lesson's Declaring starters in a Maven pom.xml example, create a small implementation or design sketch that demonstrates Starters bundle compatible sets of dependencies for a specific concern (web, data, security, testing).. Add a test case or scenario that would catch Following a Spring Boot 3 tutorial in a Boot 4 project and adding spring-boot-starter-web. It still works but is deprecated; use spring-boot-starter-webmvc., and describe the expected result.
Show hints
- Start with Commonly Used Starters and compare your approach with Declaring starters in a Maven pom.xml. Identify the decision or behavior the lesson recommends.
- Walk through your scenario step by step. Confirm that it follows Starters bundle compatible sets of dependencies for a specific concern (web, data, security, testing). and that it would catch the failure described by Following a Spring Boot 3 tutorial in a Boot 4 project and adding spring-boot-starter-web. It still works but is deprecated; use spring-boot-starter-webmvc..
Quick quiz
1. Which choice is a mistake to avoid in Spring Boot Starters?
- A. Starters bundle compatible sets of dependencies for a specific concern (web, data, security, testing).
- B. Following a Spring Boot 3 tutorial in a Boot 4 project and adding spring-boot-starter-web. It still works but is deprecated; use spring-boot-starter-webmvc.
- C. Adding a test dependency such as @WebMvcTest support without the matching test starter (spring-boot-starter-webmvc-test), so the test slice annotations cannot be found.
Show answer
B. Avoid this approach: Following a Spring Boot 3 tutorial in a Boot 4 project and adding spring-boot-starter-web. It still works but is deprecated; use spring-boot-starter-webmvc. The lesson recommends: Starters bundle compatible sets of dependencies for a specific concern (web, data, security, testing).
Interview questions
How would you apply the guidance in Commonly Used Starters to a real task, and what failure would you guard against?
Show answer
Starters bundle compatible sets of dependencies for a specific concern (web, data, security, testing). Apply this in Commonly Used Starters; the example Declaring starters in a Maven pom.xml shows one way to do it. Avoid Following a Spring Boot 3 tutorial in a Boot 4 project and adding spring-boot-starter-web. It still works but is deprecated; use spring-boot-starter-webmvc. and explain how your implementation or design prevents that failure.
Key Points to Remember
- Starters bundle compatible sets of dependencies for a specific concern (web, data, security, testing).
- spring-boot-starter-webmvc, -data-jpa, -validation and -security are the most commonly used starters in real applications.
- Spring Boot 4 splits starters by technology and adds a matching test starter for each (e.g. spring-boot-starter-webmvc-test).
- What is on the classpath (via starters) directly determines which auto-configuration classes activate.
- Prefer starters over hand-picking individual library versions to avoid compatibility issues.
Practice in the playground
Write and run your own code for this topic, or start from the exercise or an example. Runs plain Java 17. Frameworks such as Spring, and databases, are not available here. Your code for each topic is kept in this browser.
Run the examples
Change an input, predict the result, then compare it with the output. Explain why the result changes.
These examples need a JDK project with their libraries on your computer, so they can be copied but not run here. Codelab runs Python, FastAPI backends with SQLite, plain Java 17 and HTML/CSS/JavaScript.
Written by
WebNest Studio Engineering Team
Practical lessons from developers working with Java, Python, React, databases and production systems.
Led by Vansh Duggal, Founder, WebNest Studio · Full-stack & software engineering