原理考究(重点:自动装配)
一、pom.xml:
1.父依赖
- spring-boot-dependencies:核心依赖(真正管理SpringBoot应用里面所有依赖版本的地方,SpringBoot的版本控制中心)
- 我们在写入或者引入springboot依赖的时候 默认是不需要指定版本的 因为有这些版本仓库(但如果导入的包没有在依赖中管理着就需要手动配置了)
2.启动器starter
- 说白了就是springboot的启动场景
- springboot将所有的功能场景都抽取出来,做成一个个的启动器,我们要用什么功能,就在项目中引入这些启动器即可,所有相关的依赖都会导入进来
<?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
https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.6.6</version>
<relativePath/>
</parent>
<groupId>com.hiss</groupId>
<artifactId>springboot-01-helloworld</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>springboot-01-helloworld</name>
<description>hiss first springboot project</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId