Device Resources API is a RESTful service built with Java and Spring Boot to manage device information, including CRUD operations, database persistence, auditing, and interactive documentation.
- Create, read, update, and delete (CRUD) devices
- Exception handling for common errors
- Auditing fields (createdAt, updatedAt, createdBy, updatedBy)
- MySQL database integration
- Docker Compose setup for easy deployment
- Ready-to-use Postman collection for API testing
- Interactive API documentation via Swagger UI
- Integrated unit and integration testing
- Java 21
- Spring Boot 3
- Maven
- MySQL
- Spring-data-jpa
- JPA
- Docker
- Docker Compose
- JUnit 5
- Mockito
- Lombok
- Swagger UI (OpenAPI 3)
- Postman (for API testing)
- Java 21
- Maven 3.9
- Docker and Docker Compose
- Postman (optional, for testing)
git clone [email protected]:abimaelrsergio/devices_api.git
cd devices_api
Navigate to the docker-compose
directory and run:
cd docker-compose
docker-compose up -d
This will start:
- A MySQL database container
- The Device Resources API application container
The API will be available at: http://localhost:8080
You must have MySQL running locally and configure the database credentials in src/main/resources/application.yml
.
Then run:
./mvnw spring-boot:run
After starting the application (using Docker or Maven), you can access the Swagger UI documentation at:
It provides a complete and interactive description of all available endpoints.
A ready-to-use Postman collection is included:
Tests.postman_collection.json
- Open Postman.
- Click
Import
. - Select the
Tests.postman_collection.json
file. - Start testing the API endpoints easily!
Method | Endpoint | Description |
---|---|---|
GET | /api/devices |
List all devices |
GET | /api/devices/{id} |
Get device by ID |
GET | /api/devices?brand={brand} |
Get device by brand |
GET | /api/devices?state={state} |
Get device by state |
POST | /api/devices |
Create a new device |
PUT | /api/devices/{id} |
Update a device |
DELETE | /api/devices/{id} |
Delete a device |
curl -X POST http://localhost:8080/devices \
-H "Content-Type: application/json" \
-d '{"name": "LapTop", "brand": "Dell", "state": "IN_USE"}'
The MySQL database schema is automatically initialized from the schema.sql
file located in src/main/resources/
.
To execute all unit and integration tests:
./mvnw test
Tests are located under src/test/java/com/abimael/deviceresources/
.
src/
├── main/
│ ├── java/com/abimael/deviceresources
│ │ ├── controller/
│ │ ├── dto/
│ │ ├── entity/
│ │ ├── exception/
│ │ ├── mapper/
│ │ ├── repository/
│ │ ├── service/
│ │ └── util/
│ └── resources/
│ ├── application.yml
│ └── schema.sql
└── test/
└── java/com/abimael/deviceresources/
docker-compose/
└── docker-compose.yml
Tests.postman_collection.json
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
Licensed under the Apache License, Version 2.0
With over 26 years of software engineering experience, I am a proactive and responsible Java developer focusing on backend systems. I have strong technical knowledge and a track record of delivering solid systems that increase revenue. I am pursuing my Ph.D. in Informatics and Knowledge Management at Uninove University in Brazil, where I research evolutionary dynamics for population games based on cellular automata, machine learning and genetic algorithms.
I use Java (Spring Boot, Spring Cloud) to create innovative and scalable solutions for various projects. I am constantly updating myself with the newest technologies and concepts on the market to offer the best possible solution for clients. I am passionate about learning new skills and solving challenging problems.
• Backend: Java, Spring Boot, Spring Cloud, Docker.
• In the process of learning: Containerization & orchestration (Docker Compose, Kubernetes, Helm), observability and monitoring (Prometheus, Grafana, Loki, Tempo, Promtail), messaging systems (Kafka, RabbitMQ, Spring Cloud Stream), and microservices security (OAuth2, OpenID Connect, Spring Security).
• Databases: PostgreSQL, MongoDB, MySQL, Oracle, Microsoft SQL Server, DB2.
• Versioning Tools: Git.
• Masters in Informatics.\
• Curiosity.
• Teamwork.
• Proactive.
• Self-taught.
- @abimaelrsergio
- 📫 Contact me [email protected]