<!--引入springboot的父工程--><!--引入springboot的父工程-->
<<parentparent>>
<<groupIdgroupId>>org.springframework.bootorg.springframework.boot</</groupIdgroupId>>
<<artifactIdartifactId>>spring-boot-starter-parentspring-boot-starter-parent</</artifactIdartifactId>>
<<versionversion>>2.3.4.RELEASE2.3.4.RELEASE</</versionversion>>
</</parentparent>>
<<dependenciesdependencies>>
<!--要用springboot开发web场景模块,就引入springboot对应web模块的依赖--><!--要用springboot开发web场景模块,就引入springboot对应web模块的依赖-->
<<dependencydependency>>
<<groupIdgroupId>>org.springframework.bootorg.springframework.boot</</groupIdgroupId>>
<<artifactIdartifactId>>spring-boot-starter-webspring-boot-starter-web</</artifactIdartifactId>>
</</dependencydependency>>
</</dependenciesdependencies>>
xml ›
每个springboot工程,都要引入springboot父项目依赖,
因为在maven中,父项目的作用,是用来做依赖管理,会声明非常多的依赖,子项目继承父项
目后,就不用再写依赖的版本号。
1.1.2、无需关注版本号,自动版本仲裁
...
1、引入依赖默认都可以不写版本
2、但引入非版本仲裁的jar,要写版本号。
原理:
springboot的父项目spring-boot-starter-parent,又引用了spring-boot-dependencies
作为父项目。其中properties属性几乎声明了所有开发中常用的依赖的版本号。
所以我们引入指定模块依赖时便会自动找到对应版本的包。这称为自动版本仲裁机制。
文档被以下合辑收录
评论