SpringBoot的pom详解

SpringBoot的pom详解

以我本地的项目pom为例,来进行解释:

SpringBoot项目的父项目

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

SpringBoot项目的父项目的父项目

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-dependencies</artifactId>
    <version>2.5.3</version>
  </parent>

该依赖是真正管理Spring Boot应用里面的所有依赖版本,也称为Spring Boot的版本仲裁中心,因此,以后导入依赖默认是不需要写版本;(没有在dependencies里面管理的依赖自然需要声明版本号)

导入的依赖spring-boot-starter-web

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

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

Spring boot将所有的功能场景都抽取出来,做成一个个starters(启动器),只需要在项目里面引用这些starter相关场景的所有依赖都会导入进来。要用什么功能就导入什么场景的启动器
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
引用\[8\]:pom.xml文件详解pom.xml文件是Maven项目的核心配置文件,用于管理项目的依赖、插件、构建配置等。在Spring Boot项目中,pom.xml文件也扮演着重要的角色。在pom.xml文件中,可以配置项目的资源文件。 在Spring Boot的pom.xml文件中,通常会有一个<resources>标签,用于配置项目的资源文件。资源文件可以包括静态文件、配置文件等。在<resources>标签中,可以使用<resource>标签来指定资源文件的路径和过滤规则。 例如,可以使用以下配置来指定资源文件的路径和过滤规则: ```xml <resources> <resource> <directory>src/main/resources</directory> <includes> <include>**/*.properties</include> <include>**/*.xml</include> </includes> </resource> </resources> ``` 上述配置中,<directory>标签指定了资源文件的路径为src/main/resources,<includes>标签指定了需要包含的资源文件的过滤规则。在这个例子中,所有的.properties和.xml文件都会被包含在项目的资源文件中。 通过配置pom.xml文件中的<resources>标签,可以方便地管理项目的资源文件,使其能够在项目中正确地被加载和使用。 #### 引用[.reference_title] - *1* *3* [SpringBoot入门pom.xml文件详解,Resources目录结构详解Springboot创建项目,注解详解等等,博主为很少人](https://blog.csdn.net/m0_52789121/article/details/124038257)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* [SpringBoot入门pom.xml文件详解,Resources目录结构详解Springboot创建项目,注解详解等等,博主为很少人...](https://blog.csdn.net/qq_38101814/article/details/91044906)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值