-
SpringBoot 继承 spring-boot-starter-parent
-
spring-boot-starter-parent 继承 spring-boot-dependencies
【1】咱们可以进入 spring-boot-dependencies 看一看,按住 Ctrl 点击 spring-boot-dependencies,截取部分代码:
<activemq.version>5.15.3</activemq.version>
<antlr2.version>2.7.7</antlr2.version>
<appengine-sdk.version>1.9.63</appengine-sdk.version>
<artemis.version>2.4.0</artemis.version>
<aspectj.version>1.8.13</aspectj.version>
<assertj.version>3.9.1</assertj.version>
<atomikos.version>4.0.6</atomikos.version>
<bitronix.version>2.1.4</bitronix.version>
<build-helper-maven-plugin.version>3.0.0</build-helper-maven-plugin.version>
<byte-buddy.version>1.7.11</byte-buddy.version>
… … …
org.springframework.boot
spring-boot
2.0.1.RELEASE
org.springframework.boot
spring-boot-test
2.0.1.RELEASE
… … …
org.jetbrains.kotlin
kotlin-maven-plugin
${kotlin.version}
org.jooq
jooq-codegen-maven
${jooq.version}
org.springframework.boot
spring-boot-maven-plugin
2.0.1.RELEASE
… … …
这些配置里面主要是定义一些坐标的版本、依赖管理、插件管理,这里会根据我们在spring-boot-starter-parent定义的版本来提供相应版本的匹配,这就很好的解决了Spring导入版本依赖冲突的问题,所以我们的 SpringBoot 工程继承 spring-boot-starter-parent 后已经具备版本锁定等配置了。
可以看出起步依赖的作用就是进行依赖的传递。
【2】在 spring-boot-starter-parent 中,还有一个地方咱们可以看一下,那就是资源引入:
true
${basedir}/src/main/resources
**/application*.yml
**/application*.yaml
**/application*.properties
可以看到,${basedir}/src/main/resources 表示资源的加载文件,资源文件包括下面三种格式的,也就是说,咱们在配置SpringBoot资源文件的时候都是以 application*.yml、application*.yaml、application*.properties文件格式
2、spring-boot-starter-web
spring-boot-starter-web 是web功能的起步依赖,导入了web功能的起步依赖后,可以不用导入Spring和SpringMVC的坐标,是因为starter-web 将坐标打包了,同样,可以来看看源码,按住 Ctrl 点击 spr