This application is a CRUD REST API for managing users.
- Java 17
- Spring Boot
- Spring Data JPA
- MySQL
- Maven
- Swagger UI
- Lombok
| Method | URL | Description |
|---|---|---|
| POST | /api/users |
Create a user |
| GET | /api/users/{id} |
Get user by ID |
| GET | /api/users |
Get all users with search, sort, and pagination |
| PUT | /api/users/{id} |
Update user |
| DELETE | /api/users/{id} |
Delete user |
{
"firstName": "John",
"lastName": "Doe",
"dateOfBirth": "1990-05-19",
"phoneNumber": "1234567890",
"email": "john@example.com"
}Make sure the following tools are installed:
- Java 17 or later
- Maven 3.8+
- MySQL Server
- IntelliJ IDEA (recommended)
- Create a new MySQL database:
CREATE DATABASE userdb;- Configure your database in
application.properties:
spring.datasource.url=jdbc:mysql://localhost:3306/userdb
spring.datasource.username=your_mysql_username
spring.datasource.password=your_mysql_password
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQLDialect- Clone the repository:
git clone https://github.com/your-username/user-management-api.git
cd user-management-api- Build the project:
mvn clean install- Run the application:
mvn spring-boot:runThe application will start on:
http://localhost:8080
Once the application is running, access the Swagger UI at:
http://localhost:8080/swagger-ui/index.html