创建spring boot项目
使用https://start.aliyun.com/ 创建一个spring boot项目
1、打开https://start.aliyun.com/,获取代码
2、解压下载后文件,使用ide打开,pom。xml文件添加,install一下
<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency>
3、建一个Controller文件
package com.example.controller;import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;@RestController
public class HelloController {@GetMapping("/hello")public String hello(){return "hello spring,boot";}
}
4、运行DemoApplication.java文件
5、打开http://localhost:8080/hello