1.maven创建项目
2.导入依赖
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.5.0</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
</dependencies>
3.创建启动类
@SpringBootApplication
public class LoginApplication {
public static void main(String[] args){
SpringApplication.run(LoginApplication.class);
}
}
4.创建访问路由
@RestController
public class Controller {
@RequestMapping("/hello")
public String hello(){
return "hello";
}
}
5.运行项目,浏览器访问http://localhost:8080/+路由