Master APIJSON with Spring Boot 3: 116 Real-World Demo Cases
This article introduces APIJSON, a zero‑code JSON‑based ORM for APIs, outlines its key features, and provides a step‑by‑step Spring Boot 3 demo—including cloning the repository, configuring the database, and performing full CRUD operations via Postman with code examples.
1. Introduction
APIJSON is a JSON‑based network transmission protocol and ORM library designed for APIs. It provides a universal, zero‑code CRUD interface that automatically generates documentation, handles permissions, versioning and SQL‑injection protection, greatly reducing development and communication costs.
Key Features
Universal API eliminates the need to write most HTTP endpoints.
Zero‑code CRUD, cross‑table joins, nested queries.
Automatic documentation with static checks.
Built‑in permission validation, version management and SQL‑injection defense.
Version‑free HTTP API that remains compatible.
2. Practical Demo
2.1 Clone the demo
<code>git clone https://github.com/APIJSON/APIJSON-Demo.git</code>2.2 Import the project
Import the APIJSON-Demo-master/APIJSON-Java-Server/APIJSONDemo module.
2.3 Modify configuration
Edit DemoSQLConfig to set the MySQL connection, schema and table‑key mapping (e.g., map "User" to "x_user" ).
<code>public class DemoSQLConfig extends APIJSONSQLConfig<Long, JSONObject, JSONArray> {
static {
DEFAULT_DATABASE = DATABASE_MYSQL;
DEFAULT_SCHEMA = "batch";
TABLE_KEY_MAP.put("User", "x_user");
// ... other tables
}
@Override public String gainDBVersion() { return "5.7.22"; }
@JSONField(serialize = false) @Override public String gainDBUri() { return "jdbc:mysql://localhost:3306?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=UTF-8"; }
@JSONField(serialize = false) @Override public String gainDBAccount() { return "root"; }
@JSONField(serialize = false) @Override public String gainDBPassword() { return "xxxooo"; }
}</code>2.4 CRUD operations via Postman
Use the provided DemoController endpoints. Examples:
Add : POST a User object; the request succeeds.
Update : PUT with the same User key to change the name field.
Delete : DELETE the User record.
Query : GET a single record by id , query specific columns, or perform paginated queries by adding "page" and "count" parameters.
<code>{
"[]": {
"User": {
"@column": "id,name,sex,age,area"
},
"page": 3,
"count": 10
}
}</code>For more query patterns, refer to the official grammar documentation.
Source code is available at https://github.com/Tencent/APIJSON .
Spring Full-Stack Practical Cases
Full-stack Java development with Vue 2/3 front-end suite; hands-on examples and source code analysis for Spring, Spring Boot 2/3, and Spring Cloud.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.