# 项目创建

  • 使用Spring Initializer
  • 手写

# 使用Spring Initialler

  • https://start.spring.io
  • https://start.aliyun.com

# 手写

# 新建Maven项目 {#新建Maven项目}

  • src
    • main
      • java
        • 坐标
      • resource
    • test
      • java
        • 坐标
      • resource

Maven项目结构示例

# 填写pom {#填写pom}

# parent

引入Springboot父坐标

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>3.4.3</version>
    <relativePath/>
</parent>
# plugin

引入Springboot插件

<plugin>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
# dependency

引入基础依赖

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
</dependency>
# 示例:

pom文件示例

# 编写SpringBoot启动类 {#编写SpringBoot启动类}

// @SpringBootApplication是一个复合注解包含了很多东西
@SpringBootApplication
public class TestPaperRgbApplication {

    public static void main(String[] args) {
        SpringApplication.run(TestPaperRgbApplication.class, args);
    }

}

# 后续工作

# 配置文件(yaml)

yaml文件中存放着有关项目的全部配置,一般放在resources文件夹中