暂无图片
暂无图片
暂无图片
暂无图片
暂无图片
3-了解自动配置原理.pdf
215
60页
1次
2022-11-15
10墨值下载
1SpringBoot特点
.
1.1、依赖管理
..
 
1.1.1、父项目做依赖管理
...
  在helloworld案例中,依赖只需要引入一个springboot父项目依赖、一个指定场景模块的
子项目依赖,指定场景下将要使用的所有包就能自动导入到项目中。
<!--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>>
<!--springbootwebspringbootweb--><!--springbootwebspringbootweb-->
<<dependencydependency>>
<<groupIdgroupId>>org.springframework.bootorg.springframework.boot</</groupIdgroupId>>
<<artifactIdartifactId>>spring-boot-starter-webspring-boot-starter-web</</artifactIdartifactId>>
</</dependencydependency>>
</</dependenciesdependencies>>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
xml
每个springboot工程,都要引入springboot父项目依赖,
因为在maven中,父项目的作用,是用来做依赖管理,会声明非常多的依赖,子项目继承父项
目后,就不用再写依赖的版本号。
1.1.2、无需关注版本号,自动版本仲裁
...
  1、引入依赖默认都可以不写版本
2、但引入非版本仲裁的jar,要写版本号。
  原理:
springboot的父项目spring-boot-starter-parent,又引用了spring-boot-dependencies
作为父项目。其中properties属性几乎声明了所有开发中常用的依赖的版本号。
所以我们引入指定模块依赖时便会自动找到对应版本的包。这称为自动版本仲裁机制。
  
of 60
10墨值下载
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文档的来源(墨天轮),文档链接,文档作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

文档被以下合辑收录

评论

关注
最新上传
暂无内容,敬请期待...
下载排行榜
Top250 周榜 月榜