e9858bfec1dfb10e01b871e233f91912bf1b274a
主要修改: 1. 降级Spring Boot版本到2.7.18以兼容MyBatis-Plus 2. 修复所有validation包导入路径 (jakarta -> javax) 3. 修复ResponseStatusException API调用 4. 降级Swagger版本以兼容Spring Boot 2.x 5. 添加单个和批量删除链接功能 6. 修复JWT认证中的Claims获取方式 7. 优化代码格式和日志输出 技术细节: - Spring Boot: 3.3.3 -> 2.7.18 - Swagger: springdoc-openapi-starter-webflux-ui:2.3.0 -> springdoc-openapi-webflux-ui:1.7.0 - 所有javax.validation包路径修复 - 新增BatchDeleteRequest和BatchDeleteResponse DTO类 - LinkController中添加DELETE和POST批量删除接口
Game Platform Server (Spring Boot WebFlux + MyBatis + MySQL)
A minimal backend scaffold using Spring Boot 3, WebFlux, MyBatis, and MySQL. Includes a sample User CRUD implemented via MyBatis (blocking JDBC) safely wrapped in reactive APIs.
Tech Stack
- Spring Boot 3 (WebFlux, Actuator)
- MyBatis Spring Boot Starter (JDBC)
- MySQL Connector/J
- Java 17
Blocking JDBC with WebFlux
MyBatis uses JDBC which is blocking. To keep WebFlux event loop non-blocking, all data access is offloaded to Schedulers.boundedElastic() (see UserService). This is a common and safe pattern when you need WebFlux endpoints but must use JDBC/MyBatis.
Project Layout
pom.xml– Maven build, dependenciessrc/main/resources/application.yml– datasource + mybatis configsrc/main/resources/mapper/*.xml– MyBatis mappers (XML)src/main/resources/schema.sql– initial tablesrc/main/java/com/gameplatform/server– application code
Configure Database
- Create database:
CREATE DATABASE game_platform CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci; - Update
spring.datasource.*inapplication.ymlwith your MySQL credentials. - Run the SQL init:
USE game_platform; -- then execute contents of src/main/resources/schema.sql
Build & Run
Requires JDK 17+ and Maven 3.9+.
mvn spring-boot:run
The app starts on http://localhost:8080.
Endpoints
GET /actuator/health– health checkGET /api/users– list usersGET /api/users/{id}– get user by idPOST /api/users– create user- body:
{"username": "alice", "email": "alice@example.com"}
- body:
DELETE /api/users/{id}– delete user
Notes
- If you need true end-to-end reactive IO, consider R2DBC instead of JDBC/MyBatis. Here we keep MyBatis for mapping convenience and use bounded elastic threads to avoid blocking the event loop.
Description
Languages
Java
98%
Python
2%