# springboot4.x-template **Repository Path**: wangznan/springboot4.x-template ## Basic Information - **Project Name**: springboot4.x-template - **Description**: SpringBoot 4.0.2 + JDK 25 极简 Web 项目模板,提供开箱即用的最小可行项目结构。 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-02-11 - **Last Updated**: 2026-03-09 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # SpringBoot 4.x Template SpringBoot 4.0.2 + JDK 25 极简 Web 项目模板,提供开箱即用的最小可行项目结构。 ## 技术栈 | 技术 | 版本 | 说明 | |---|---|---| | JDK | 25 | Java 开发环境 | | Spring Boot | 4.0.2 | 核心框架 | | Lombok | - | 简化 Java 代码 | | JUnit 5 | - | 单元测试 | ## 项目结构 ``` springboot4.x-template/ ├── src/ │ ├── main/ │ │ ├── java/com/wang/template/ │ │ │ └── TemplateApplication.java # 启动类 │ │ └── resources/ │ │ └── application.yml # 配置文件 │ └── test/java/com/wang/template/ │ └── TemplateApplicationTests.java # 测试类 └── pom.xml # Maven 依赖管理 ``` ## 环境要求 - JDK 25+ - Maven 3.9+ ## 多环境配置 项目通过 Maven Profile 实现多环境配置,构建时自动替换。 - **应用名称**: 通过 Maven 变量 `@project.artifactId@` 自动注入 - **环境激活**: 通过 Maven Profile 注入 `@profile.active@` | Profile | 环境 | 说明 | 激活命令 | |---|---|---|---| | `dev` | 开发环境 | 默认激活 | `mvn package` | | `prod` | 生产环境 | 需要显式指定 | `mvn package -Pprod` | ### 1. 克隆项目 ```bash git clone https://gitee.com/wangznan/springboot4.x-template.git cd springboot4.x-template ``` ### 2. 运行项目 ```bash mvn spring-boot:run -Dfile.encoding=UTF-8 ``` 应用启动后默认监听 `10010` 端口,访问 http://localhost:10010 。 ### 3. 打包部署 ```bash # 开发环境打包 mvn clean package -DskipTests -Dfile.encoding=UTF-8 # 生产环境打包 mvn clean package -Pprod -DskipTests -Dfile.encoding=UTF-8 ``` ### 4. 运行 JAR ```bash java -Dfile.encoding=UTF-8 -jar target/template-0.0.1.jar ``` ### 5. 运行测试 ```bash mvn test -Dfile.encoding=UTF-8 ``` ## Git 提交规范 项目采用 [Angular 提交规范](https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#-git-commit-guidelines),格式如下: ```text ():