一、SpringBoot介绍
Spring Boot是由Pivotal团队提供的一套开源框架,简化了spring应用的创建及部署。提供了丰富的Spring模块化支持,可以帮助开发者更轻松快捷地构建出企业级应用。Spring Boot通过自动配置功能,降低了复杂性,同时支持基于JVM的多种开源框架,可以缩短开发时间,使开发更加简单和高效。
二、搭建SpringBoot项目
IDEA版本:IntelliJ IDEA 2021.3.1
Java版本:1.8
SpringBoot版本:3.1.0
1.新建项目步骤
File —> new ——> project ——>Spring Initializr,打开IDEA点击File选中new在选中project点击弹出Spring Initializr页面
2.点击Next(下一步)
3.SpringBooot启动入口
<?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>
<!--引入SpringBoot依赖管理,在pom中引用“spring-boot-starter-*”此类依赖,不再需要引用版本号-->
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.1.0</version>
<!--相对路径-->
<relativePath/>
</parent>
<groupId>com.spring</groupId>
<artifactId>springboot</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>springboot</name>
<!--项目的描述说明-->
<description>这是一个SpringBoot测试项目</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<!--SpringBoot web中嵌入Tomcat和Spring MVC依赖-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!--SpringBoot热部署依赖-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<!--SpringBoot测试依赖-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<!--maven打包方式-->
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>