Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
192 views
in Technique[技术] by (71.8m points)

java - 是否每个Spring Boot应用程序都需要spring-boot-starter-parent(Does every spring boot application requires spring-boot-starter-parent)

I am starting on spring boot and used Spring boot inititlizr, and I see parent pom to be included, for example:

(我开始使用Spring spring boot并使用了Spring Boot inititlizr,并且看到包括父pom,例如:)

  <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.10.RELEASE</version>
        <relativePath /> <!-- lookup parent from repository -->
    </parent>

I then wanted to have Spring web , and the following got added:

(然后,我想拥有Spring web ,并添加了以下内容:)

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

I have following questions:

(我有以下问题:)

Q1: Is it mandatory for every spring boot application to have spring-boot-starter-parent as its parent pom?

(问题1:每个spring boot应用程序是否必须将spring-boot-starter-parent作为其父pom?)

How about the situations in which we have multi-module projects?

(我们拥有多模块项目的情况如何?)

Q2: For specific type of project, for example, Spring MVC / Sprint REST , it added spring-boot-starter-web .

(问题2:对于特定类型的项目,例如Spring MVC / Sprint REST ,它添加了spring-boot-starter-web 。)

So did this added the real dependencies for it?

(那么这是否增加了真正的依赖关系呢?)

If so, then why we need spring-boot-starter-parent to begin with?

(如果是这样,那为什么我们需要spring-boot-starter-parent呢?)

  ask by CuriousMind translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...