SpringBoot入门第二集:创建springboot项目的三种方式

创建SpringBoot项目的方式

第一种创建方式

创建项目步骤

1.1.1新建项目

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

在这里插入图片描述
选择依赖
在这里插入图片描述
最后创建项目,设置项目的目录位置

SpringBoot 项目目录结构
在这里插入图片描述

1.1.1.2 起始依赖

在这里插入图片描述

第二种创建方式

使用Springboot提供的初始化器,使用国内的地址:https://start.springboot.io

创建项目的步骤同上
在这里插入图片描述
在这里插入图片描述

第三种方式

使用maven想到创建项目

创建一个普通maven项目

在这里插入图片描述
在这里插入图片描述
修改项目的目录
在这里插入图片描述
创建springboot依赖

<dependencies>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-web</artifactId>
		</dependency>

		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-test</artifactId>
			<scope>test</scope>
		</dependency>
	</dependencies>
<build>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
			</plugin>
		</plugins>
	</build>

创建启动类,加入@SpringBootApplication注解

@SpringBootApplication
public class Application {
    
    

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

}

最后请大家多多支持我,好的文章来自粉丝们的鼓励,期待下一集的分享

猜你喜欢

转载自blog.csdn.net/weixin_43608968/article/details/123139814