SpringBoot Hello World探究(学习笔记4)

1、POM文件:

spring-boot-starter:spring-boot场景启动器。 spring-boot-starter-*

    1)、父项目:

    <!-- 引用依赖的父包 -->
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.1.RELEASE</version>
    </parent>
点击 spring-boot-starter-parent 进入它的父项目
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-dependencies</artifactId>
        <version>2.0.1.RELEASE</version>
        <relativePath>../../spring-boot-dependencies</relativePath>
    </parent>
spring-boot-dependencies 是真正管理 Spring Boot 应用里面的所有依赖版本,是 Spring Boot 的版本仲裁中心。以后我们导入依赖默认是不需要写版本的,如果没有在 dependencies 里面管理的依赖,自然需要声明版本号。点击 spring-boot-dependencies ,可以查看到相关依赖信息。

2)、导入的依赖启动器:

<!-- 依赖包 -->
    <dependencies>
        <!-- spring boot需要的包 -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
    </dependencies>



spring-boot-starter:spring-boot场景启动器;spring-boot-starter-web 帮助我们导入 web 模块正常运行所依赖的组件:


Spring Boot 将所有的功能场景都抽取出来,做成了一个个的 starters(启动器),只需要在项目里引入这些 starter 相关场景的所有依赖都会导入进来,

版本由 Spring Boot 自动控制 。需要什么功能就导入什么场景启动器。

地址:https://docs.spring.io/spring-boot/docs/2.0.1.RELEASE/reference/htmlsingle/#using-boot-starter







 
感谢--尚硅谷



猜你喜欢

转载自blog.csdn.net/yufang131/article/details/80238367