springboot 框架 - 探究-pom文件

一、pom文件

  1. 父项目
    1 <parent>
    2         <groupId>org.springframework.boot</groupId>
    3         <artifactId>spring-boot-starter-parent</artifactId>
    4         <version>2.2.4.RELEASE</version>
    5         <relativePath/> <!-- lookup parent from repository -->
    6 </parent>

    他的父项目是:

    1  <parent>
    2     <groupId>org.springframework.boot</groupId>
    3     <artifactId>spring-boot-dependencies</artifactId>
    4     <version>2.2.4.RELEASE</version>
    5     <relativePath>../../spring-boot-dependencies</relativePath>
    6   </parent>

    用来真正管理Spring Boot应用里面的所有依赖版本

    所以这个父项目相当于“Spring Boot的版本控制中心”,即导入依赖时无需写版本号                                                                                                                     备注:没有在spring-boot-dependencies 里面管理的依赖仍需要声明版本号                     

  2. 导入的依赖
    1   <dependency>
    2         <groupId>org.springframework.boot</groupId>
    3         <artifactId>spring-boot-starter-web</artifactId>
    4   </dependency>

    spring-boot-starter:spring-boot场景启动器,导入了web模块正常运行所依赖的组建

    Spring Boot将所有的功能场景抽取出来,做成一个个的starters(启动器),只需要在项目里面引入这些 starter,相关场景所有依赖都会导入进来,需要用什么功能,就导入什么场景启动器即可。

    具体场景启动器可参照Spring Boot官网

猜你喜欢

转载自www.cnblogs.com/mysummary/p/12238054.html