SpringBoot项目创建
一、通过maven创建springboot项目
1、创建项目
File -> new -> Projectimg
做完以上步骤就创建了一个项目但是不是springboot项目
2、maven导入springboot相关依赖
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.4.RELEASE</version>
<relativePath/>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
3、启动项目
创建一个用于启动springboot项目的类
/**
* @SpringBootApplication 来标注一个主程序类,说明这是一个springboot应用
*/
@SpringBootApplication
public class HelloWorldApplication {
public static void main(String[] args) {
//spring应用启动
SpringApplication.run(HelloWorldApplication.class);
}
}
直接运行springboot项目即可
二、通过spring Initializr快速创建springboot项目
1、创建项目
File -> new -> Projectimg
2、启动项目
由于使用spring Initializr已经帮你创建好了springboot主类,直接运行即可