Wednesday, October 30, 2019

Spring Boot: Parent POM importance

Everyone must have written few Spring boot code and exposed some applications.

if you have noticed every Spring boot application has below as parent 

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.1.5.RELEASE</version>
</parent>

What does the above line signifies, if you remove this, the project might not build.

Actually this one parent does the following behind the scene
1. Add all necessary config, like java versions. basedir etc.
2. include all resource files to path
3. Add necessary maven plugins
4. Add all necessary spring resources with versions, every parent version has supported versions of all necessary versions of spring resources like activemq version, hibernate version, cassandra-driver version etc...


essense is instead of you managing versions for all dependencies, spring will take care of versions which are stable.

so it is of great use.

No comments: