Spring Boot REST API for managing payment records with JPA, MySQL persistence, layered DAL/service design, and expanded update/delete operations.
This project demonstrates a compact Spring Boot payment-management API built with a layered architecture. It extends the initial version by adding full update, delete, and targeted description-update capabilities, making the project a stronger CRUD learning showcase over a JPA and Hibernate-backed MySQL data store.
- Spring Boot REST API setup
- JPA and Hibernate-based persistence
- Layered controller, service, and DAL design
GETendpoint for retrieving a payment by IDGETendpoint for listing all paymentsGETendpoint for filtering payments by typeGETendpoint for searching payments by description keywordPOSTendpoint for saving a paymentDELETEendpoint for removing a paymentPUTendpoint for updating a full payment recordPUTendpoint for updating only the payment description- Custom exception handling for missing, duplicate, and invalid input cases
- Java 17
- Spring Boot 3
- Spring Web
- Spring Data JPA
- Hibernate
- MySQL
- Maven
- JUnit 5
payment-management-api/
├── CHANGELOG.md
├── README.md
├── pom.xml
├── mvnw
├── mvnw.cmd
└── src/
└── main/
├── java/com/cn/cnpayment/
│ ├── controller/
│ ├── dal/
│ ├── entity/
│ ├── exception/
│ ├── service/
│ └── CnPaymentApplication.java
└── resources/
└── application.yml
- Open a terminal in the project root.
- Update the MySQL connection values in
src/main/resources/application.ymlif needed. - Run
mvn test. - Run
mvn spring-boot:run. - Use the API under
http://localhost:8080/payment.
Available endpoints:
GET /payment/id/{id}GET /payment/allPaymentsGET /payment/paymentType/{paymentType}GET /payment/description/{keyword}POST /payment/saveDELETE /payment/delete/id/{id}PUT /payment/updatePUT /payment/update/{id}/description/{description}
Example request body:
{
"id": 1,
"paymentType": "Credit",
"description": "Updated online order payment"
}- Demonstrates how to separate persistence concerns into a dedicated DAL layer
- Shows how Hibernate sessions can be used through
EntityManager - Extends a basic read/create API into fuller CRUD behavior with targeted update endpoints
- Connects a simple REST API to a real MySQL-backed persistence flow
- Suggested repository description:
Spring Boot REST API for payment record management with JPA, MySQL persistence, layered DAL/service design, and full CRUD-style update/delete operations. - Suggested topics:
java,java-17,spring-boot,spring-data-jpa,hibernate,mysql,rest-api,payment-management,crud-api,maven,learning-project,portfolio-project