Spring Boot 4 入门
1. 环境准备
- JDK 21(必须)
- Maven 3.9+
- IDEA 2024+
2. 第一个接口
@RestController
public class HelloController {
@GetMapping("/hello")
public String hello() { return "hello"; }
}
至此可以 mvn spring-boot:run 启动并访问 http://localhost:8080/hello 验证。