Spring-boot-starter Maven Templates

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.

The 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-orm, hibernate-entity-manager and 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.

Starter Dependencies
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-actuator spring-boot-actuator, micrometer-core
spring-boot-starter-aop spring-aop, aspectjrt, aspectjweaver
spring-boot-starter-data-rest spring-hateoas, spring-data-rest-webmvc
spring-boot-starter-hateoas spring-hateoas
spring-boot-starter-logging logback-classic, jcl-over-slf4j, jul-to-slf4j
spring-boot-starter-log4j2 log4j2, log4j-slf4j-impl
spring-boot-starter-security spring-security-web, spring-security-config
spring-boot-starter-test spring-test, spring-boot,junit,mockito, hamcrest-library, assertj, jsonassert, json-path
spring-boot-starter-web-services spring-ws-core

Drop me your questions in comments section.

Happy Learning !!


Spring boot starters
Using boot starters

Comments are closed for this article!

About Us

HowToDoInJava provides tutorials and how-to guides on Java and related technologies.

It also shares the best practices, algorithms & solutions and frequently asked interview questions.