使用spring starter project创建项目

设置Service URL
把Service URL设置为
https://start.aliyun.com/
如下图:

使用这个网址,创建项目更快。
选择Spring Web依赖
项目结构

mvnw和mvnw.cmd:这是maven包装器(wrapper)脚本,借助这些脚本,没有maven,也可以构建项目。
创建HelloController
java
@RestController
public class HelloController {
@GetMapping("/hello")
public String hello() {
return "hello Spring Boot";
}
}
运行和测试项目
基本与上面一样,不同的是已经存在application.properties,不需要新建。