1.

Is it possible to have a Spring Boot Application without Spring Boot Starter Parent? If yes, when will you do that?

Answer»

In the majority of cases, you will build a Spring BOOT application using Spring Boot Starter Parent. However, there could be a case where you need to be very explicit about your dependencies and maven configuration. This could be a case of CORPORATE RULES or policies.

In such cases, you may use scope=import to get the benefit of dependency MANAGEMENT intact. For example,

<dependencyManagement>      <dependencies>         <dependency>             <!-- Import dependency management from Spring Boot -->             <groupId>org.springframework.boot</groupId>             <artifactId>spring-boot-dependencies</artifactId>             <version>2.1.6.release</version>             <type>POM</type>             <scope>import</scope>         </dependency>     </dependencies> </dependencyManagement>

Now include the required entries in dependencyManagement section before spring-boot-dependencies .For example,

The next step is we need to add an entry in the dependencyManagement of your project before the spring-boot-dependencies entry. For example, you could add the following element to your pom.xml:

<dependencyManagement>     <dependencies>         <dependency>             <groupId>org.springframework.data</groupId>             <artifactId>spring-data-releasetrain</artifactId>             <version>Fowler-SR2</version>             <type>pom</type>             <scope>import</scope>         </dependency>         <dependency>             <groupId>org.springframework.boot</groupId>             <artifactId>spring-boot-dependencies</artifactId>             <version>2.1.0.BUILD-SNAPSHOT</version>             <type>pom</type>             <scope>import</scope>         </dependency>     </dependencies> </dependencyManagement>


Discussion

No Comment Found