一、新建工程

二、工程建好后,在pom文件中加入springboot 依赖
bash
<dependencies>
<!--SpringBoot启动依赖-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>2.6.3</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<version>2.6.3</version>
<scope>test</scope>
</dependency>
</dependencies>

三、在src文件夹下,新建文件夹src/main/java,src/main/resources两个目录。

四、在创建一个包路径。例如com.test.mongodb

五、在以上包路径下创建spring boot启动类
java
@SpringBootApplication
public class SpringBootMongoDBApplication {
public static void main(String[] args) {
SpringApplication.run(SpringBootMongoDBApplication.class,args);
}
}

六、在resources文件夹下创建application.yml 文件

完成以上六步既可以运行启动springboot项目了。