0
点赞
收藏
分享

微信扫一扫

springboot(2)起步依赖原理分析

微笑沉默 2022-01-03 阅读 58

1 起步依赖原理分析

我们的工程继承parent,引入starter后,通过依赖传递,就可以简单方便获得需要的jar包,并且不会存在版本冲突等问题。
pom文件

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.yy</groupId>
    <artifactId>springboot</artifactId>
    <version>1.0-SNAPSHOT</version>

<!--    springboot工程需要继承的父工程-->
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.8.RELEASE</version>
    </parent>
    <dependencies>
<!--        web开发的起步依赖-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
    </dependencies>

</project>

1.1 spring-boot-starter-parent

在这个里面定义了一些版本的信息

在spring-boot-starter-parent中定义了各种技术的版本信息,组合了一套最优搭配的技术版本。

1.2 spring-boot-starter-web

在各种starter中,定义了完成该功能需要的坐标合集,其中大部分版本信息来自于父工程。

举报

相关推荐

0 条评论