SpringBoot学习_父项目和场景启动器

文章目录

父项目

在pom.xml中有这样一个父项目:

	<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>2.0.6.BUILD-SNAPSHOT</version>
		<relativePath/> <!-- lookup parent from repository -->
	</parent>

父项目是用来做依赖管理的
按住ctrl键点击spring-boot-starter-parent跳转,可以看到这个父项目还依赖于另一个父项目

	<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-dependencies</artifactId>
        <version>2.0.6.BUILD-SNAPSHOT</version>
        <relativePath>../../spring-boot-dependencies</relativePath>
    </parent>

同样的方法再点击spring-boot-dependencies跳转,可以看到这个父项目是来真正管理Spring Boot应用里面的所有依赖版本:
在这里插入图片描述
所以这个父项目叫Spring Boot的版本仲裁中心
以后我们导入依赖默认是不需要写版本;(没有在dependencies里面管理的依赖需要声明版本号)

场景启动器

<dependency>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring‐boot‐starter‐web</artifactId>
</dependency>

spring-boot-starter:spring-boot场景启动器;它可以帮我们导入了web模块正常运行所依赖的组件;
Spring Boot将所有的功能场景都抽取出来,做成一个个的starters(启动器),我们只需要在项目里面引入这些starter,相关场景的所有依赖就都会导入进来。要用什么功能就导入什么场景的启动器
各种各样的启动器可以在参考文档中可以找到
在这里插入图片描述
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qq_36901488/article/details/83011244