Spring Boot provides many starters that allow us to add dependencies (jars) in the classpath. Spring Boot built-in starters make development easier and rapid. Spring Boot Starters are the dependency descriptors.

If you have any prior experience of working with Spring MVC, you will be knowing how tedious it is configuring the dependencies for your project.

Spring Boot starters are built to address this issue. Find out more reasons for using it here. You include a starter for web and every jar that you require for web will be added to your classpath.

Table of Contents

What is a Spring Boot Starter?

Spring Boot starters are templates that contain a collection of all the relevant transitive dependencies that are needed to start a particular functionality.

Here is an example of dependencies you will have to add in pom.xml in the traditional Spring project to implement Spring security:

<!-- spring security --> <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-web</artifactId> <version>${spring.security.version}</version> </dependency> <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-config</artifactId> <version>${spring.security.version}</version> </dependency> <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-taglibs</artifactId> <version>${spring.security.version}</version> </dependency>
Code language: HTML, XML (xml)

The same thing can be achieved in Spring Boot by adding a single starter (as shown below).

<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-security</artifactId> </dependency>
Code language: HTML, XML (xml)

In the Spring Boot Framework, all the starters follow a similar naming pattern: spring-boot-starter-*, where denotes a particular type of application. For example, if we want to use Spring and JPA for database access, we need to include the spring-boot-starter-data-jpa dependency in our pom.xml file of the project.

Commonly used starters

spring-boot-starter-thymeleafIt is used to build MVC web applications using Thymeleaf views.
spring-boot-starter-web-servicesIt is used for Spring Web Services.
spring-boot-starter-mailIt is used to support Java Mail and Spring Framework’s email sending.
spring-boot-starter-data-redisIt is used for Redis key-value data store with Spring Data Redis and the Jedis client.
spring-boot-starter-webIt is used for building the web application, including RESTful applications using Spring MVC. It uses Tomcat as the default embedded container.
spring-boot-starter-testIt is used to test Spring Boot applications with libraries, including JUnit, Hamcrest, and Mockito.
spring-boot-starter-jdbcIt is used for JDBC with the Tomcat JDBC connection pool.
spring-boot-starter-securityIt is used for Spring Security.
spring-boot-starter-log4j2It is used for Log4j2 for logging. An alternative to spring-boot-starter-logging.
spring-boot-starter-loggingIt is used for logging using Logback. Default logging starter.
Commonly used Spring Boot Starters

Adding starters to your project

The simplest way to add a starter to your project is by adding dependencies while initializing the project using Spring Initializr. When you click on the Add Dependencies(indicated in the screenshot given below) button, you get a list of starters from which you can select.

Add dependencies in Spring Initializr
Add dependencies in Spring Initializr

The other way is to add <dependency> tags inside <dependencies> tag in pom.xml.

<dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-mail</artifactId> </dependency> </dependencies>
Code language: HTML, XML (xml)
Scroll to Top