Skillversitas

Spring Boot Starters

What Is a Starter?

A starter is a dependency bundle curated by the Spring Boot team. A single starter includes all the libraries, default configuration, and transitive dependencies needed for a specific feature.

Without starters, you'd have to add many dependencies one by one and make sure their versions are compatible. With starters, one dependency is enough.

How Starters Work

<!-- This single starter already includes: -->
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
</dependency>
Libraries Included Automatically
Spring MVC
Jackson (JSON serialization)
Tomcat (embedded server)
Hibernate Validator
SLF4J + Logback (logging)

spring-boot-starter-web

For web applications and REST APIs:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
</dependency>

spring-boot-starter-data-jpa

For database access with JPA/Hibernate:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>

<!-- Add a database driver -->
<dependency>
    <groupId>com.mysql</groupId>
    <artifactId>mysql-connector-j</artifactId>
    <scope>runtime</scope>
</dependency>

spring-boot-starter-security

For authentication and authorization:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-security</artifactId>
</dependency>

spring-boot-starter-test

For testing:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-test</artifactId>
    <scope>test</scope>
</dependency>

Includes: JUnit 5, Mockito, AssertJ, Spring Test, Hamcrest.

spring-boot-starter-actuator

For monitoring and health checks:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

Access the endpoints:

GET /actuator/health
GET /actuator/info
GET /actuator/metrics

spring-boot-devtools

Devtools speeds up development with auto-restart when the code changes:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-devtools</artifactId>
    <scope>runtime</scope>
    <optional>true</optional>
</dependency>
Feature Description
Auto-restart Restarts the application when files change
Live reload The browser auto-refreshes
Property defaults Disables caching for development

Devtools is automatically active in development and disabled in production.

Complete pom.xml Example

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</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-test</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>com.h2database</groupId>
        <artifactId>h2</artifactId>
        <scope>runtime</scope>
    </dependency>
</dependencies>

With starters, setting up dependencies is much faster and safer. In the next chapter, we'll understand how Component Scanning works — how Spring finds and manages components in your project.