Spring Boot Starters: Intializing a Spring Boot Project with Spring Starters

Spring Boot Starters

Spring Boot supports several starters to make development easier and rapid. The Spring Boot starters are useful for adding jars in the classpath; they are the dependency descriptors.

The Spring Boot starters follows the similar naming patterns, which is “spring-boot-starter-*“, for example, spring-boot-starter-parent, spring-boot-starter-web, spring-boot-starter-jpa, etc. Each starter represents a specific application type. For example, if we want to use JPA for database access, we have to add the spring-boot-starter-jpa dependency in our pom.xml file of our project.

” In a nutshell, the Spring Boot Starters are a set of convenient dependency descriptors that we can include in our project.”

They are like a one-stop-shop for all our project need; we do not need to go through sample code and copy-paste lots of dependencies for our project. A Spring Boot starter contains lots of the dependencies for bootstrapping and running a project quickly with a consistent, supported set of managed transitive dependencies.

When building RESTful web services, we need to add several additional functionalities to our project. For example, we may need to add the database, cache data, or work with LDAP or MongoDB; there are several third party libraries that we will have to add to our project’s pom.xml file. Here, Spring Boot starters simplifies this work for us by adding required libraries.

in this section, we have included:

About the Naming Pattern of Starters

All the official Spring Boot Starters follow a similar naming pattern, which is “spring-boot-starter-*“, where * is a particular type of application. You must be thinking about why it is named like this? Then, they are named similarly to help in finding a starter. The Maven integration in many IDEs allows searching for the starters by name. For example, in Eclipse IDE or STS IDE, we can access the complete list of starters in the POM editor by pressing CTRL+SPACE key and typing “spring-boot-starter”.

However, Spring Boot supports several third party starters; they should not start with spring-boot, as it is reserved for official Spring Boot artifacts. Rather, they will start with the name of the project. For example, a third-party starter for a project called librarymanagement would typically be named as librarymanagement-spring-boot-starter.

How to Add Spring Boot Starters to a Spring Boot Project

We can easily add a Spring Boot starter to our spring boot project by defining it’s configuration to pom.xml file of the project. For example, to add spring-boot-starter-data-jpa to the list of dependencies, put the below code in pom.xml file within the <dependencies> tag:

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

To add JUnit tests, add the following code to the list of dependencies in our pom.xml file.

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

If we have 3 starters added to our pom.xml file, the pom.xml file will look like as follows:

<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>
 </dependencies>

Spring Boot Starters List

Below is the list of application starters provided by Spring Boot under the org.springframework.boot group:

Spring Boot Application Starters

NameDescription
spring-boot-starterIt is a core starter, including auto-configuration support, logging and YAML
spring-boot-starter-activemqIt is a starter for JMS messaging using Apache ActiveMQ
spring-boot-starter-amqpIt is a starter for using Spring AMQP and Rabbit MQ
spring-boot-starter-aopIt is a starter for aspect-oriented programming with Spring AOP and AspectJ
spring-boot-starter-artemisIt is starter for JMS messaging using Apache Artemis
spring-boot-starter-batchIt is starter for using Spring Batch
spring-boot-starter-cacheIt is a starter for using Spring Framework’s caching support
spring-boot-starter-data-cassandraIt is a starter for using Cassandra distributed database and Spring Data Cassandra
spring-boot-starter-data-cassandra-reactiveIt is a starter for using Cassandra distributed database and Spring Data Cassandra Reactive
spring-boot-starter-data-couchbaseIt is a starter for using Couchbase document-oriented database and Spring Data Couchbase
spring-boot-starter-data-couchbase-reactiveIt is a starter for using Couchbase document-oriented database and Spring Data Couchbase Reactive
spring-boot-starter-data-elasticsearchIt is a starter for using Elasticsearch search and analytics engine and Spring Data Elasticsearch
spring-boot-starter-data-jdbcIt is a starter for using Spring Data JDBC
spring-boot-starter-data-jpaIt is a starter for using Spring Data JPA with Hibernate
spring-boot-starter-data-ldapIt is a starter for using Spring Data LDAP
spring-boot-starter-data-mongodbIt is a starter for using MongoDB document-oriented database and Spring Data MongoDB
spring-boot-starter-data-mongodb-reactiveIt is a starter for using MongoDB document-oriented database and Spring Data MongoDB Reactive
spring-boot-starter-data-neo4jIt is a starter for using Neo4j graph database and Spring Data Neo4j
spring-boot-starter-data-r2dbcIt is a starter for using Spring Data R2DBC
spring-boot-starter-data-redisIt is a starter for using Redis key-value data store with Spring Data Redis and the Lettuce client
spring-boot-starter-data-redis-reactiveIt is a starter for using Redis key-value data store with Spring Data Redis reactive and the Lettuce client
spring-boot-starter-data-restIt is a starter for exposing Spring Data repositories over REST using Spring Data REST
spring-boot-starter-data-solrIt is a starter for using the Apache Solr search platform with Spring Data Solr
spring-boot-starter-freemarkerIt is a starter for building MVC web applications using FreeMarker views
spring-boot-starter-groovy-templatesIt is a starter for building MVC web applications using Groovy Templates views
spring-boot-starter-hateoasIt is a starter for building hypermedia-based RESTful web application with Spring MVC and Spring HATEOAS
spring-boot-starter-integrationIt is a starter for using Spring Integration
spring-boot-starter-jdbcIt is a starter for using JDBC with the HikariCP connection pool
spring-boot-starter-jerseyIt is a starter for building RESTful web applications using JAX-RS and Jersey. An alternative to spring-boot-starter-web
spring-boot-starter-jooqIt is a starter for using jOOQ to access SQL databases. An alternative to spring-boot-starter-data-jpa or spring-boot-starter-jdbc
spring-boot-starter-jsonIt is a starter for reading and writing json
spring-boot-starter-jta-atomikosIt is a starter for JTA transactions using Atomikos
spring-boot-starter-jta-bitronixIt is a starter for JTA transactions using Bitronix. Deprecated since 2.3.0
spring-boot-starter-mailIt is a starter for using Java Mail and Spring Framework’s email sending support
spring-boot-starter-mustacheIt is a starter for building web applications using Mustache views
spring-boot-starter-oauth2-clientIt is a starter for using Spring Security’s OAuth2/OpenID Connect client features
spring-boot-starter-oauth2-resource-serverIt is a starter for using Spring Security’s OAuth2 resource server features
spring-boot-starter-quartzIt is a starter for using the Quartz scheduler
spring-boot-starter-rsocketIt is a starter for building RSocket clients and servers
spring-boot-starter-securityIt is a starter for using Spring Security
spring-boot-starter-testIt is a starter for testing Spring Boot applications with libraries including JUnit Jupiter, Hamcrest and Mockito
spring-boot-starter-thymeleafIt is a starter for building MVC web applications using Thymeleaf views
spring-boot-starter-validationIt is a starter for using Java Bean Validation with Hibernate Validator
spring-boot-starter-webIt is a starter for building web, including RESTful, applications using Spring MVC. Uses Tomcat as the default embedded container
spring-boot-starter-web-servicesIt is a starter for using Spring Web Services
spring-boot-starter-webfluxIt is a starter for building WebFlux applications using Spring Framework’s Reactive Web support
spring-boot-starter-websocketIt is a starter for building WebSocket applications using Spring Framework’s WebSocket support

In addition to the application starters, the following are some production starters which can be used to add production ready features:

Spring Boot Production Starters

NameDescription
spring-boot-starter-actuatorIt is a starter for using Spring Boot’s Actuator which provides production ready features to help you monitor and manage your application

Finally, Spring Boot also includes the some technical starters that can be used if you want to exclude or swap specific technical facets:

Spring Boot Technical Starters

NameDescription
spring-boot-starter-jettyIt is a starter for using Jetty as the embedded servlet container. An alternative to spring-boot-starter-tomcat
spring-boot-starter-log4j2It is a starter for using Log4j2 for logging. An alternative to spring-boot-starter-logging
spring-boot-starter-loggingIt is a starter for logging using Logback. Default logging starter
spring-boot-starter-reactor-nettyIt is a starter for using Reactor Netty as the embedded reactive HTTP server.
spring-boot-starter-tomcatIt is a starter for using Tomcat as the embedded servlet container. Default servlet container starter used by spring-boot-starter-web
spring-boot-starter-undertowIt is a starter for using Undertow as the embedded servlet container. An alternative to spring-boot-starter-tomcat

The above list is obtained from the Official Guide of Spring.

Also See,
Spring Boot Dependencies
Spring Boot Annotations