Spring Boot Starters

Starter is like a small Spring project for each module such as web MVC, JDBC, ORM, and so on. For your Spring application, you just add the starters of the respective module in the classpath, and Spring Boot will ensure that the necessary libraries are added to the build by using Maven or Gradle. As a developer, you don't need to worry about the module libraries and dependent versions of libraries, that is, transitive dependencies.

Spring Boot documentation says Starters are a set of convenient dependency descriptors that you can include in your application. You get a one-stop-shop for all the Spring and related technologies that you need, without having to hunt through sample code and copy-paste loads of dependency descriptors.

Suppose you want to create a web application or an application to expose RESTful services using the Spring web MVC module to your Spring application; just include the springboot-starter-web dependency in your project, and you are good to go.

Let's see what it would look like in the Spring application:

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

This starter dependency resolves the following transitive dependencies:

  • spring-web-*.jar
  • spring-webmvc-*.jar
  • tomcat-*.jar
  • jackson-databind-*.jar

See the following diagram about spring-boot-starter-web:

Fig : Spring Boot Starters

The spring-boot-starter not only reduces the build dependency count, but also adds specific functionality to your build. In your case, you added the web starter to your Spring application, so it provides web functionality that your application needs. Similarly, if your application will use ORM, then you can add the orm starter. If it needs security, you can add the security starter.

Spring Boot provides a wide range of Starter projects. Spring Boot provides the following application Starters under the org.springframework.boot group:

  • spring-boot-starter-web-services: For building applications exposing SOAP web services.
  • spring-boot-starter-web: Build web applications and RESTful applications.
  • spring-boot-starter-test: Write great unit and integration tests.
  • spring-boot-starter-jdbc: Traditional JDBC applications.
  • spring-boot-starter-hateoas: Make your services more RESTful by adding HATEOAS features.
  • spring-boot-starter-security: Authentication and authorization using Spring Security.
  • spring-boot-starter-data-jpa: Spring Data JPA with Hibernate.
  • spring-boot-starter-cache: Enabling the Spring Framework's caching support.
  • spring-boot-starter-data-rest: Expose simple REST services using Spring Data REST.

Below Table lists all of Spring Boot’s starter dependencies along with the dependencies that they transitively declare.

Starter Transitively depends on

spring-boot-starter

  • org.springframework.boot:spring-boot
  • org.springframework.boot:spring-boot-autoconfigure
  • org.springframework.boot:spring-boot-starter-logging
  • org.springframework:spring-core
  • org.yaml:snakeyaml

spring-boot-starter-web

  • org.springframework.boot:spring-boot-starter
  • org.springframework.boot:spring-boot-starter-tomcat
  • org.springframework.boot:spring-boot-starter-validation
  • com.fasterxml.jackson.core:jackson-databind
  • org.springframework:spring-web
  • org.springframework:spring-webmvc

spring-boot-starter-actuator

  • org.springframework.boot:spring-boot-starter
  • org.springframework.boot:spring-boot-actuator

spring-boot-starter-data-jpa

  • org.springframework.boot:spring-boot-starter
  • org.springframework.boot:spring-boot-starter-aop
  • org.springframework.boot:spring-boot-starter-jdbc
  • org.hibernate:hibernate-entitymanager
  • javax.transaction:javax.transaction-api
  • org.springframework.data:spring-data-jpa
  • org.springframework:spring-aspects

spring-boot-starter-jdbc

  • org.springframework.boot:spring-boot-starter
  • org.apache.tomcat:tomcat-jdbc
  • org.springframework:spring-jdbc

spring-boot-starter-log4j

  • org.slf4j:jcl-over-slf4
  • org.slf4j:jul-to-slf4j
  • org.slf4j:slf4j-log4j12
  • log4j:log4j

spring-boot-starter-security

  • org.springframework.boot:spring-boot-starter
  • org.springframework:spring-aop
  • org.springframework.security:spring-security-config
  • org.springframework.security:spring-security-config

spring-boot-starter-test

  • junit:junit
  • org.mockito:mockito-core
  • org.hamcrest:hamcrest-core
  • org.hamcrest:hamcrest-library
  • org.springframework:spring-core
  • org.springframework:spring-test

spring-boot-starter-thymeleaf

  • org.apache.tomcat.embed:tomcat-embed-core
  • org.apache.tomcat.embed:tomcat-embed-el
  • org.apache.tomcat.embed:tomcat-embed-logging-juli
  • org.apache.tomcat.embed:tomcat-embed-websocket

spring-boot-starter-data-rest

  • org.springframework.boot:spring-boot-starter
  • org.springframework.boot:spring-boot-starter-web
  • com.fasterxml.jackson.core:jackson-annotations
  • com.fasterxml.jackson.core:jackson-databind
  • org.springframework.data:spring-data-rest-webmvc