1、创建一个空的maven项目
2、在pom.xml中加入springboot官方父依赖
<!--引入springboot官方依赖--> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.7.10</version> </parent> <dependencies> <!--引入springboot依赖--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> </dependencies>
3、创建自定义启动类SpringBootMavenApplication
@SpringBootApplication public class SpringBootMavenApplication { public static void main(String[] args) { SpringApplication.run(SpringBootMavenApplication.class,args); } }