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
- How to Add Spring Boot Starters to a Spring Boot Project
- Spring Boot Starters List
- Spring Boot Application Starters
- Spring Boot Production Starters
- Spring Boot Technical Starters
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
Name | Description |
---|---|
spring-boot-starter | It is a core starter, including auto-configuration support, logging and YAML |
spring-boot-starter-activemq | It is a starter for JMS messaging using Apache ActiveMQ |
spring-boot-starter-amqp | It is a starter for using Spring AMQP and Rabbit MQ |
spring-boot-starter-aop | It is a starter for aspect-oriented programming with Spring AOP and AspectJ |
spring-boot-starter-artemis | It is starter for JMS messaging using Apache Artemis |
spring-boot-starter-batch | It is starter for using Spring Batch |
spring-boot-starter-cache | It is a starter for using Spring Framework’s caching support |
spring-boot-starter-data-cassandra | It is a starter for using Cassandra distributed database and Spring Data Cassandra |
spring-boot-starter-data-cassandra-reactive | It is a starter for using Cassandra distributed database and Spring Data Cassandra Reactive |
spring-boot-starter-data-couchbase | It is a starter for using Couchbase document-oriented database and Spring Data Couchbase |
spring-boot-starter-data-couchbase-reactive | It is a starter for using Couchbase document-oriented database and Spring Data Couchbase Reactive |
spring-boot-starter-data-elasticsearch | It is a starter for using Elasticsearch search and analytics engine and Spring Data Elasticsearch |
spring-boot-starter-data-jdbc | It is a starter for using Spring Data JDBC |
spring-boot-starter-data-jpa | It is a starter for using Spring Data JPA with Hibernate |
spring-boot-starter-data-ldap | It is a starter for using Spring Data LDAP |
spring-boot-starter-data-mongodb | It is a starter for using MongoDB document-oriented database and Spring Data MongoDB |
spring-boot-starter-data-mongodb-reactive | It is a starter for using MongoDB document-oriented database and Spring Data MongoDB Reactive |
spring-boot-starter-data-neo4j | It is a starter for using Neo4j graph database and Spring Data Neo4j |
spring-boot-starter-data-r2dbc | It is a starter for using Spring Data R2DBC |
spring-boot-starter-data-redis | It is a starter for using Redis key-value data store with Spring Data Redis and the Lettuce client |
spring-boot-starter-data-redis-reactive | It is a starter for using Redis key-value data store with Spring Data Redis reactive and the Lettuce client |
spring-boot-starter-data-rest | It is a starter for exposing Spring Data repositories over REST using Spring Data REST |
spring-boot-starter-data-solr | It is a starter for using the Apache Solr search platform with Spring Data Solr |
spring-boot-starter-freemarker | It is a starter for building MVC web applications using FreeMarker views |
spring-boot-starter-groovy-templates | It is a starter for building MVC web applications using Groovy Templates views |
spring-boot-starter-hateoas | It is a starter for building hypermedia-based RESTful web application with Spring MVC and Spring HATEOAS |
spring-boot-starter-integration | It is a starter for using Spring Integration |
spring-boot-starter-jdbc | It is a starter for using JDBC with the HikariCP connection pool |
spring-boot-starter-jersey | It is a starter for building RESTful web applications using JAX-RS and Jersey. An alternative to spring-boot-starter-web |
spring-boot-starter-jooq | It 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-json | It is a starter for reading and writing json |
spring-boot-starter-jta-atomikos | It is a starter for JTA transactions using Atomikos |
spring-boot-starter-jta-bitronix | It is a starter for JTA transactions using Bitronix. Deprecated since 2.3.0 |
spring-boot-starter-mail | It is a starter for using Java Mail and Spring Framework’s email sending support |
spring-boot-starter-mustache | It is a starter for building web applications using Mustache views |
spring-boot-starter-oauth2-client | It is a starter for using Spring Security’s OAuth2/OpenID Connect client features |
spring-boot-starter-oauth2-resource-server | It is a starter for using Spring Security’s OAuth2 resource server features |
spring-boot-starter-quartz | It is a starter for using the Quartz scheduler |
spring-boot-starter-rsocket | It is a starter for building RSocket clients and servers |
spring-boot-starter-security | It is a starter for using Spring Security |
spring-boot-starter-test | It is a starter for testing Spring Boot applications with libraries including JUnit Jupiter, Hamcrest and Mockito |
spring-boot-starter-thymeleaf | It is a starter for building MVC web applications using Thymeleaf views |
spring-boot-starter-validation | It is a starter for using Java Bean Validation with Hibernate Validator |
spring-boot-starter-web | It is a starter for building web, including RESTful, applications using Spring MVC. Uses Tomcat as the default embedded container |
spring-boot-starter-web-services | It is a starter for using Spring Web Services |
spring-boot-starter-webflux | It is a starter for building WebFlux applications using Spring Framework’s Reactive Web support |
spring-boot-starter-websocket | It 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
Name | Description |
---|---|
spring-boot-starter-actuator | It 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
Name | Description |
---|---|
spring-boot-starter-jetty | It is a starter for using Jetty as the embedded servlet container. An alternative to spring-boot-starter-tomcat |
spring-boot-starter-log4j2 | It is a starter for using Log4j2 for logging. An alternative to spring-boot-starter-logging |
spring-boot-starter-logging | It is a starter for logging using Logback. Default logging starter |
spring-boot-starter-reactor-netty | It is a starter for using Reactor Netty as the embedded reactive HTTP server. |
spring-boot-starter-tomcat | It is a starter for using Tomcat as the embedded servlet container. Default servlet container starter used by spring-boot-starter-web |
spring-boot-starter-undertow | It 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.