Spring Boot 学习第一课:pom配置文件中引用的依赖的细节解释

最近开始学习Spring Boot,关于配置文件有部分理解,请见红色注释部分。


<?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>com.atguigu</groupId>
<artifactId>spring-boot-01-helloworld</artifactId>
<version>1.0-SNAPSHOT</version>

<!--spring-boot-starter-parent:spring-boot项目中的starter项目的父项目。
spring-boot-starter-parent的父项目是spring-boot-dependencies,
在properties中集成管理了Spring Boot应用的所有的依赖版本,类似于Spring Boot的版本仲裁中心。
所以开发人员在导入依赖版本时,不需要写版本,只有在dependencies中没有的依赖才需要声明版本号-->
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.3.RELEASE</version>
</parent>

<!--spring-boot-starter:spring-boot场景的启动器;帮开发人员导入web模块正常运行所依赖的组件-->
<!--Spring Boot 将所有的功能场景都抽取出来,做成一个个的starter(启动器),
只需要在项目中引用这些starter 相关场景的所有依赖就会导入进来。-->
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

</dependencies>

<!--spring-boot-maven-plugin,这个插件,可以将应用打包成一个可以执行的jar包-->
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

猜你喜欢

转载自www.cnblogs.com/honny-seven/p/10508021.html