September 11, 2022

Spring Boot Starters

In a project generally there are dependencies on third party libraries and looking for the correct version jar or dependency descriptors manually is a tedious process. Spring Boot which promises Rapid Application Development provides you a one-stop shop for all the Spring and related technologies that you need through Spring Boot starters.

Starters in Spring Boot

Starters are a set of convenient dependency descriptors that you can include in your application. The starter for any technology contains all the related dependencies to get that technology integrated with your project. Once you include correct starter in your application, Spring Boot ensures that all the required dependencies for the selected starter are in your classpath.

For example if you want to create a web application include spring-boot-starter-web which gets all dependencies for building web (including RESTful) applications using Spring MVC. This starter even includes Tomcat as the default embedded container.

You want to create a Spring Webflux application with MongoDB Reactive just include spring-boot-starter-webflux and spring-boot-starter-data-mongodb-reactive starters to get all the related dependencies.

Example to add Spring Boot starter to pom.xml-

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

You can get the complete list of Spring Boot starters here- https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#using-boot-starter

Naming convention for Spring Boot Starters

All official Spring Boot starters follow naming pattern convention; spring-boot-starter-*, where * is a particular type of application. This naming structure is intended to help when you need to find a starter.

Third party starters should not start with spring-boot, as it is reserved for official Spring Boot artifacts. A third-party starter typically starts with the name of the project. For example, a third-party starter project called thirdpartyproject would typically be named thirdpartyproject-spring-bootstarter.

That's all for the topic Spring Boot Starters. If something is missing or you have something to share about the topic please write a comment.


You may also like

No comments:

Post a Comment