Not very long ago, with the exponential increase in number of libraries and their dependencies, dependency management was becoming very complex task which required good amount of technical expertise to do it correctly. With the introduction of String boot starter templates, you can get a lot of help in identifying the correct dependencies to use in project if you want to use any popular library into your project.
Spring Boot comes with over 50+ different starter modules, which provide ready-to-use integration libraries for many different frameworks, such as database connections that are both relational and NoSQL, web services, social network integration, monitoring libraries, logging, template rendering, and the list just keeps going on.
How starter template work?
Spring Boot starters are templates that contain a collection of all the relevant transitive dependencies that are needed to start a particular functionality. Each starter has a special file, which contains the list of all the provided dependencies Spring provides.
These files can be found inside
pom.xml files in respective starter module. e.g.
spring-boot-starter-data-jpa starter pom file can be found at github.
This tells us that by including
spring-boot-starter-data-jpa in our build as a dependency, we will automatically get
spring-data-jpa. These libraries will provide us all basic things to start writing JPA/DAO code .
So next time when you want to give your project any specific functionality, I will suggest to check for existing starter templates to see if you can use it directly. Ongoing community additions are always on, so this list is already growing and you can contribute to it as well.
Popular templates and their transitive dependencies
I am listing down some very frequently use spring starters and what dependencies they bring along, for information only.
|spring-boot-starter||spring-boot, spring-context, spring-beans|
|spring-boot-starter-jersey||jersey-container-servlet-core, jersey-container-servlet, jersey-server|
|spring-boot-starter-aop||spring-aop, aspectjrt, aspectjweaver|
|spring-boot-starter-logging||logback-classic, jcl-over-slf4j, jul-to-slf4j|
|spring-boot-starter-test||spring-test, spring-boot,junit,mockito, hamcrest-library, assertj, jsonassert, json-path|
Drop me your questions in comments section.
Happy Learning !!