IDEA快速构建SpringBoot项目

305 阅读1分钟

创建新项目

File->New->Project。

image-20240623142432499

image-20240623142509560

创建Spring Boot项目

image-20240623142631182

image-20240623143112732

选择依赖

image-20240623145653544

这里选择的依赖是基本的依赖,后续还可以在pom文件中添加依赖。

等待加载依赖。

在加载依赖时可能会遇到这样的错误。

Unresolved plugin: 'org.springframework.boot:spring-boot-maven-plugin:3.2.7'

出现这样的错误,是应为找不到Spring Boot对应版本的依赖,将Spring Boot版本降低即可解决。

image-20240623144638095

这里版本为3.2.7,改为3.2.6。

image-20240623144732297

重新加载依赖。

image-20240623144808096

image-20240623144828326

重新加载依赖成功解决。

启动项目

按照如下目录找到启动文件。

src->main->java->com.xxx.xxx->xxApplication.java

image-20240623145139513

image-20240623145224068

看到这样的日志表示启动成功。

image-20240623145344697