Spring Boot starter parents

Starter POMs

Reading material: https://docs.spring.io/spring-boot/docs/1.2.3.RELEASE/reference/html/using-boot-build-systems.html#using-boot-starter-poms

Starter POMs are a set of convenient dependency descriptors that you can include in your application. You get a one-stop-shop for all the Spring and related technology that you need, without having to hunt through sample code and copy paste loads of dependency descriptors. For example, if you want to get started using Spring and JPA for database access, just include the spring-boot-starter-data-jpa dependency in your project, and you are good to go.

The starters contain a lot of the dependencies that you need to get a project up and running quickly and with a consistent, supported set of managed transitive dependencies.

By relying on these starters, we are relying on a tested and proven configuration that is going to work well together. This helps to avoid the dreaded Jar Hell.

Naming convention

All starters follow a similar naming pattern; spring-boot-starter-*, where * is a particular type of application. This naming structure is intended to help when you need to find a starter. The Maven integration in many IDEs allow you to search dependencies by name. For example, with the appropriate Eclipse or STS plugin installed, you can simply hit ctrl-space in the POM editor and type ‘‘spring-boot-starter’’ for a complete list.

Look at springboot documentation for a complete list of starter poms available.

Is it mandatory to use starter parents?

Create Spring Boot projects without using starter parents

When using Maven, it is not necessary to inherit from the spring-boot-starter-parent POM. Alternatively, we can use the dependency management mechanism:

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-dependencies</artifactId>
            <version>1.5.7.RELEASE</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

What is a starter parent bringing into the project?

If you are curious, just visit it’s dependency page and see the list of depedencies.

e.g. https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-validation/3.5.0

Dependency version management

When you are using a specific version of spring-boot-starter-parent, it pulls specific versions for all of it’s dependencies (e.g. embedded tomcat). If you want to change a different version (e.g. for embedded tomcat’s version or the version of any dependency) in existing spring boot app, you need to override the properties set in spring’s parent pom.

 <properties>
......
    <tomcat.version>9.0.5</tomcat.version>
......
<properties>

External References

https://www.springboottutorial.com/spring-boot-starter-parent

Tags

Spring auto configuration