搭建一个基础的SpringBoot项目

## 搭建一个SpringBoot项目

  1. 创建一个Maven项目
  2. 添加SpringBoot父工程
<!-- 继承SpringBoot的父工程 -->
<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-parent</artifactId>
    <version>2.3.0.RELEASE</version>
</parent>
  1. 添加SpringBoot的核心依赖
<!-- 添加SpringBoot的核心依赖 -->
<dependencies>    
<dependency>        <groupId>org.springframework.boot</groupId>        <artifactId>spring-boot-starter</artifactId>    </dependency>
</dependencies>

4.添加SpringBoot整合Maven的插件

<!-- 添加SpringBoot和Maven的整合插件 -->
<build>
    <plugins>
        <plugin>         
        <groupId>
        org.springframework.boot
        </groupId>
            <artifactId>spring-boot-maven-plugin
            </artifactId>
            <version>2.3.0.RELEASE</version>
        </plugin>
    </plugins>
</build>

5.编写启动类(main方法)

package com.zyx.application;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class DemoApplication {
    
    
    public static void main(String[] args) {
    
    
        SpringApplication.run(DemoApplication.class, args);
    }
}

6.提供SpringBoot的核心配置文件
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qq_44982110/article/details/120662991