SpringBoot 项目构建指南
小于 1 分钟
SpringBoot 项目构建指南
📋 选择合适版本
Spring Boot 官网
- 下载地址:https://spring.io/projects/spring-boot
- 版本发布说明:https://github.com/spring-projects/spring-boot/releases
Maven 仓库
- 查询坐标:https://mvnrepository.com/
- 搜索
org.springframework.boot:spring-boot-starter-parent
🛠️ 配置 pom.xml
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.2.6</version> <!-- 根据需求选择版本 -->
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- 其他 starter -->
</dependencies>⚙️ application.yml 基础配置
server:
port: 8080
spring:
application:
name: my-application
profiles:
active: dev📝 启动类示例
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}💡 注意事项
- JDK 版本要求:Spring Boot 3.x 需要 JDK 17+
- Maven 版本:建议使用 Maven 3.8+
- 版本号对齐:确保各依赖版本兼容
提示
建议先查看官方文档的 Compatibility Guide 了解版本兼容性要求。