SpringBoot的pom.xml細節

1.父項目
父項目一般是做依賴管理的

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

它的父項目是:

<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-dependencies</artifactId>
        <version>2.0.4.RELEASE</version>
        <relativePath>../../spring-boot-dependencies</relativePath>
    </parent>
    它來真正管理Spring Boot應用裏面的所有依賴版本,也可以稱爲Spring Boot的版本仲裁中心,以後我們導入依賴默認是不需要寫版本(沒有在dependencies裏面管理的依賴需要聲明版本號)

2.導入的依賴

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

spring-boot-starter:spring-boot場景啓動器
web : 導入了web模塊正常運行所依賴的組件
Spring Boot將所有的功能場景都抽取出來,做成一個個的starters(啓動器),只需要在項目裏面引入這些starter,相關場景的所有依賴都會導入進來,要用什麼功能就導入什麼場景的啓動器。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章