Javatpoint Logo
Javatpoint Logo

Spring Boot Starter Parent

Spring Boot Starter Parent

The spring-boot-starter-parent is a project starter. It provides default configurations for our applications. It is used internally by all dependencies. All Spring Boot projects use spring-boot-starter-parent as a parent in pom.xml file.

Parent Poms allow us to manage the following things for multiple child projects and modules:

  • Configuration: It allows us to maintain consistency of Java Version and other related properties.
  • Dependency Management: It controls the versions of dependencies to avoid conflict.
  • Source encoding
  • Default Java Version
  • Resource filtering
  • It also controls the default plugin configuration.

The spring-boot-starter-parent inherits dependency management from spring-boot-dependencies. We only need to specify the Spring Boot version number. If there is a requirement of the additional starter, we can safely omit the version number.

Spring Boot Starter Parent Internal

Spring Boot Starter Parent defines spring-boot-dependencies as a parent pom. It inherits dependency management from spring-boot-dependencies.

Default Parent Pom

The properties section defines the application default values. The default Java version is 1.8. We can also override Java version by specifying a property <java.version>1.8</java.version> in the project pom. The parent pom also contains the few other settings related to encoding and source. The Spring Boot framework uses these defaults in case, if we have not defined in the application.properties file.

Plugin Management

The spring-boot-starter-parent specifies the default configuration for a host of plugins including maven-failsafe-plugin, maven-jar-plugin and maven-surefire-plugin.

Spring Boot Dependencies

The spring-boot-starter-parent dependency inherit from the spring-boot-dependencies, it shares all these characteristics as well. Hence the Spring Boot manages the list of the dependencies as the part of the dependency management.

Spring Boot Starter without Parent

In some cases, we need not to inherit spring-boot-starter-parent in the pom.xml file. To handle such use cases, Spring Boot provides the flexibility to still use the dependency management without inheriting the spring-boot-starter-parent.

In the above code, we can see that we have used <scope> tag for this. It is useful when we want to use different version for a certain dependency.






Youtube For Videos Join Our Youtube Channel: Join Now

Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA