https://start.spring.io/
将生成好的项目压缩包文件,解压后,使用IDEA工具打开即可。
打开IDEA->点击New Project,选择Spring Initializer,然后next即可填写项目信息,点击next
SpringBoot版本默认选择当前推荐稳定版本即可。
按需求选择依赖,比如要创建Web项目就添加Spring Web依赖
这样一个SpringBoot项目就创建好了。
3.改造普通的maven项目- 首先先使用IDEA功能创建一个普通的maven项目
- Creating the POM
在pom.xml文件中添加parent
org.springframework.boot spring-boot-starter-parent 2.5.6
- Adding Classpath Dependencies
在pom.xml文件中添加dependencies
org.springframework.boot spring-boot-starter-web
- 在src目录下,创建一个SpringBoot项目启动类MyApplication.java
package org.cry;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@EnableAutoConfiguration
public class MyApplication {
@RequestMapping("/")
String home() {
return "Hello World!";
}
public static void main(String[] args) {
SpringApplication.run(MyApplication.class, args);
}
}
- 运行改造好的SpringBoot项目



