Learnitweb

Dependency management and starters in Spring Boot

Every Spring Boot version comes with a curated list of dependencies that it supports. These dependencies are upgraded when we upgrade the version of Spring Boot. Since these dependencies are kind of predefined and come with Spring Boot, we do not have to provide the version of dependencies in build configuration.

It is not compulsory to use the same version of dependencies as recommended by Spring Boot. We can specify version of our dependencies, if it is required. Every Spring Boot version is associated with a base version of Spring Framework. It is highly recommended that you do not specify the version.

This curated list of dependencies which comes with every version of Spring Boot has the following:

  • All required Spring Boot modules
  • A list of third party libraries

Starter dependencies in Spring Boot

Starters are a set of convenient dependency descriptors. Let us understand what this statement means with an example. The starter spring-boot-starter-web contains all the required dependencies to bootstrap a web application. So all Spring and other required dependencies (with the transitive dependencies) are taken care by the Spring Boot when we specify this starter in our pom.xml. This helps us to get started quickly as we do not have to manually specify the dependencies with their correct versions.

Following are few important and commonly used application starters. These are provided by Spring Boot under the org.springframework.boot group.

spring-boot-starterCore starter, includes support for auto-configuration, logging and YAML
spring-boot-starter-aopStarter for aspect-oriented programming with Spring AOP and AspectJ
spring-boot-starter-batchStarter for using Spring Batch
spring-boot-starter-data-jdbcStarter for using Spring Data JDBC
spring-boot-starter-data-jpaStarter for using Spring Data JPA with Hibernate
spring-boot-starter-data-ldapStarter for using Spring Data LDAP
spring-boot-starter-data-restStarter for exposing Spring Data repositories over REST using Spring Data REST
spring-boot-starter-jdbcStarter for using JDBC with the HikariCP connection pool
spring-boot-starter-jsonStarter for working with json
spring-boot-starter-testStarter for testing Spring Boot applications with libraries including JUnit Jupiter, Hamcrest and Mockito
spring-boot-starter-webStarter for building web, including RESTful, applications using Spring MVC
spring-boot-starter-actuatorStarter for using Spring Boot’s Actuator which provides production ready features to help you monitor and manage your application

Note

All official starters follow naming pattern like spring-boot-starter-*, where * is type of application. Third party starters should not start with spring-boot, as it is reserved for official Spring Boot artifacts.