目录

好用的设置

更换默认web服务器

首先排除web依赖中默认的tomacat服务器,之后再映入替换的web服务器(这里选择的是undertow)。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
    <exclusions>
        <exclusion>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
        </exclusion>
    </exclusions>
</dependency>
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-undertow</artifactId>
</dependency>

https://cdn.jsdelivr.net/gh/QiMington/picbed/image-20220705175635393.png

在父工程中管理子工程的依赖

在父工程中的properties标签中统一位置确定依赖包的版本号(推荐),在dependencyManagement管理依赖包。注意:此时依赖包没有被引入才能够木中

image-20220705180017380image-20220705180032571

在子工程中使用groupId和artifactId引入依赖包,无需指定version。此时依赖包被引入对应的工程中。

image-20220705180411147image-20220705180444013

relativePath详解

1.不加:默认是 ../pom.xml

2.在此指定

指定后将在文件系统从指定位置查找,然后是本地仓库,最后是远程仓库

(优先级 指定位置 > 本地仓库 > 远程仓库)

3.加上标签关闭这个特性(feature) ,将永远从repositories解析读取parent POM