在上篇中,我们得到如下的pom.xml
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
看看其核心类容:
1.parent
2.dependencies
按住ctrl并点击parent中spring-boot-stater-parent节点,可以看到
图片.png
spring-boot-stater-parent有一个parent spring-boot-dependencies
根据名字分析,是spring-boot项目依赖的
继续点击spring-boot-dependencies
可以看到其在properties中配置了大量的依赖版本

我当前这个版本(2.2.3.RELEASE)在properties中共配置了203个依赖的版本
properties下面 dependencyManagement节点中,配置了依赖组建的版本:
图片.png
在项目的pom.xml中查看依赖树:
图片.png
可以看到springboot-starter-web添加了tomcat,web,webmvc,spring-core,spring-context等依赖
这也就是为什么我们可以直接通过DemoApplication.main来运行,而不需要配置外部servlet容器的原因,同时,通过这个starter-web就已经将web相关的依赖都整合进来了。
springboot中提供了很多starter,比如
spring-boot-starter-web
spring-boot-starter-cache
spring-boot-starter-security
spring-boot-starter-jdbc-swagger
spring-boot-starter-data-xxx
以上spring-boot-starter-开头的都是官方支持的,这些依赖在导入的时候,无需指定版本,因为他们的版本已经在spring-boot-dependencies中指定了
还有一些第三方的:
例如mybatis-spring-boot-starter,这种以-spring-boot-starter结尾的,是第三方根据springboot的规范,实现了第三方框架与springboot的整合,引入依赖时需要指定版本,因为其版本管理不包含在spring-boot-dependencies中。