Let’s now build a Level 1 Upgraded REST API — a beginner-friendly Spring Boot CRUD project with:
✅ JSON input/output
✅ @RequestBody & @PathVariable
✅ No DB (yet) – we'll use a simple in-memory List to store data
✅ Model + Controller + Service separation
✅ Clean and extendable folder structure
✅ Project Name: simpleuserapi
Goal:
A REST API to create, list, retrieve, and delete simple user objects.
✅ Folder Structure
✅ Step-by-Step Code
🧩 1. User Model
🔧 2. UserService – In-memory Logic
🌐 3. UserController – REST Endpoints
🚀 4. SimpleUserApiApplication.java
⚙️ 5. application.properties
(Leave empty or optionally enable CORS, logs, etc.)
✅ How to Run
./mvnw spring-boot:run
✅ Next Step Options:
Would you like to:
Add H2 or MySQL DB and JPA?
Add DTO + Validation (@Valid, @NotNull)?
Add Unit Tests?
Convert it to a CRUD UI with Thymeleaf or Angular?
To build your Spring Boot project (e.g., simple_user_api) and generate a .jar file, follow these detailed steps.
✅ Step 1: Navigate to Project Folder
Open terminal or command prompt:
Make sure your pom.xml is inside this folder.
✅ Step 2: Use Maven to Build the Project
Run this command:
On Windows:
Or if Maven is installed globally:
✅ What Happens:
clean → Deletes previous target/ build folder
package → Compiles code, runs tests, packages the app as a .jar
You should see output like:
[INFO] BUILD SUCCESS
✅ Step 3: Locate the JAR File
After a successful build, Maven creates the JAR file in:
✅ Step 4: Run the Project
Use the Java command to run the JAR:
✅ Your Spring Boot app will start at:
If you have endpoints like /api/users, test using:
✅ Optional: Skip Tests While Building
If you want to build faster and skip tests (if any), use:
✅ Common Build Errors & Fixes
Would you like help:
Converting it to a .war instead of .jar?
Creating a GitHub Actions CI pipeline?
Dockerizing it?
Let me know!
Here's a complete checklist of all the APIs in your simple_user_api project, along with manual testing steps using tools like Postman, curl, or your browser (for GET requests).
✅ API Endpoints (CRUD for User)
✅ Manual Testing Steps (Beginner Friendly)
🧪 Tool Options
Postman (recommended GUI tool)
curl (command-line)
Browser (only GET)
🔧 Step 1: Run Your App
From your project root:
Ensure it's running at:
http://localhost:8080
✅ 1. POST /api/users → Create User
Request:
Method: POST
URL: http://localhost:8080/api/users
Body (JSON):
Using curl:
Expected Response:
✅ 2. GET /api/users → List All Users
Request:
Method: GET
URL: http://localhost:8080/api/users
Using curl:
Expected Response:
✅ 3. GET /api/users/{id} → Get User by ID
Example:
URL: http://localhost:8080/api/users/1
Using curl:
Expected Response:
If not found:
✅ 4. DELETE /api/users/{id} → Delete User
Example:
URL: http://localhost:8080/api/users/1
Using curl:
Expected Response:
User deleted
If not found:
User not found
✅ Summary Table
✅ Want Enhancements?
I can also help you:
Add PUT for update
Add Swagger UI for visual testing
Add input validation (@NotBlank, @Valid)
Add custom error responses or exception handler
Let me know which you'd like next!