# springboot-test-one **Repository Path**: xk857/springboot-test-one ## Basic Information - **Project Name**: springboot-test-one - **Description**: SpringBoot测试工程 - **Primary Language**: Java - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-06-01 - **Last Updated**: 2026-06-01 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # springboot-test-one:宠物商店(缺陷检测样本) ## 项目简介 这是一个 **Spring Boot + Thymeleaf + SQLite** 的宠物商店平台, 作为「基于深度学习的代码缺陷识别与优化系统」的**测试样本**。 项目刻意在代码中植入了若干**功能性缺陷**与**可优化点**, 真实标准答案请见根目录的 `BUGS.md`。 > 项目可以正常编译、启动,并完成「浏览—加购—下单」核心流程, > 缺陷表现为潜在错误(NPE、越权、超卖、并发、金额精度等),而非编译阻断。 ## 技术栈 - 后端:Spring Boot 3.3.x、Spring MVC、Spring Data JPA、Hibernate 6 - 数据库:SQLite(文件型嵌入式数据库,文件路径 `data/petshop.db`,随仓库提交) - 前端:Thymeleaf 服务端渲染 + 原生 CSS - 构建:Maven 3.9+ - JDK:**Java 17** ## 启动方式 ```bash # 确认 JDK 17 java -version # 在项目根目录运行 mvn spring-boot:run ``` 启动后浏览器访问 [http://localhost:8080](http://localhost:8080)。 首次启动会自动建表并写入示例数据(幂等:仅在表为空时插入)。 SQLite 数据库文件位于 `data/petshop.db`,**该文件随项目一起提交到 Git**, 应用重启后注册的新用户、新下的订单等运行期数据均会保留。 ## 默认账号 | 角色 | 用户名 | 密码 | |------|--------|------| | 管理员 | `admin` | `admin123` | | 普通用户 | `alice` | `alice123` | ## 功能列表 1. 首页推荐 + 分类导航 2. 商品列表,支持分类与关键词搜索 3. 商品详情页 4. 购物车:加购、改数量、删除、合计 5. 结算并下单 6. 我的订单(列表 / 详情) 7. 用户注册 / 登录 / 登出 8. 管理端:商品的增删改查 ## 目录结构(简要) ``` springboot-test-one/ ├── pom.xml ├── README.md ├── BUGS.md # 缺陷与优化点标准答案 ├── data/ │ └── petshop.db # SQLite 数据库(提交到 Git) └── src/main/ ├── java/com/example/petshop/ │ ├── config/ WebConfig、DataInitializer │ ├── interceptor/ LoginInterceptor、AdminInterceptor │ ├── controller/ Home / Product / Cart / Order / User / Admin │ ├── entity/ Category、Product、User、CartItem、Order、OrderItem │ ├── repository/ JpaRepository 接口 │ └── service/ 业务逻辑 └── resources/ ├── application.yml ├── static/css/style.css └── templates/... ``` ## 备注 - 本项目仅用于缺陷识别 / 代码优化能力测试,**不要用于生产**。 - 详细的缺陷清单与优化建议见 `BUGS.md`。