fix:java项目性能优化

This commit is contained in:
彭帅
2026-05-28 15:51:39 +08:00
parent 8b65de36b8
commit 3bdd16cbd2
54 changed files with 3178 additions and 624 deletions

View File

@@ -9,9 +9,44 @@ This server implements all BrAPI calls. It is backed by a custom database with d
Use [/calls](https://test-server.brapi.org/brapi/v1/call) (V1) or [/serverinfo](https://test-server.brapi.org/brapi/v2/serverinfo) (V2) to check the available endpoints.
## Prerequisites
* Maven 3.9
* Java 21
* Postgres 17.2
| Tool | Required version | Notes |
| --- | --- | --- |
| **Java (JDK)** | **21** (class file 65.0) | Compile **and** run must use JDK 21. Java 17 will fail at startup. |
| **Maven** | **3.9.9+** | Used to build and run the backend. |
| **PostgreSQL** | **17.2** | Empty schema; tables/data load on first startup. |
This repo ships pinned tooling under `.tools/` (Windows-friendly):
- JDK: `.tools/jdk-21.0.11+10` (Temurin 21.0.11)
- Maven: `.tools/apache-maven-3.9.9`
**PowerShell** (set env before `mvn`; do not use CMD `set` syntax in PowerShell):
```powershell
$env:JAVA_HOME = "D:\maimaiproject\brapi-java\.tools\jdk-21.0.11+10"
$env:Path = "$env:JAVA_HOME\bin;" + $env:Path
java -version # should show 21.0.11
mvn -version # Java version should also be 21
```
**CMD**:
```cmd
set JAVA_HOME=D:\maimaiproject\brapi-java\.tools\jdk-21.0.11+10
set Path=%JAVA_HOME%\bin;%Path%
```
Or use the bundled Maven directly:
```powershell
$env:JAVA_HOME = "D:\maimaiproject\brapi-java\.tools\jdk-21.0.11+10"
$env:Path = "$env:JAVA_HOME\bin;" + $env:Path
.\.tools\apache-maven-3.9.9\bin\mvn.cmd clean install
.\.tools\apache-maven-3.9.9\bin\mvn.cmd spring-boot:run
```
Adjust the path if your checkout is not `D:\maimaiproject\brapi-java`.
## Auth Configuration
BrAPI has provided a [sample central authentication service for the test server](https://brapi.org/oauth).