This is an educational project using Spring Boot to create an API for generating service orders, focusing on the implementation of exceptions and logging.
This project demonstrates the use of Spring Boot to build a REST API for managing service orders. It emphasizes the implementation of custom exceptions and logging mechanisms to handle errors effectively.
- Java
- Spring Boot
- Maven
- Docker
- SQL (MySQL)
- Java 21
- Maven 3.8+
- Docker (optional, for containerized deployment)
- Clone the repository:
git clone https://github.com/DJAngel973/exceptions-and-logs.git cd exceptions-and-logs
- Build the project using Maven:
./mvnw clean install
- Run the application:
./mvnw spring-boot:run
- (optional) Run the application in a Docker container:
docker-compose up
- Access the API in your browser or a tool like Postman:
http://localhost:8080
-
API Endpoints:
POST /api/clientes/registrar: Register a new client.GET /api/clientes/id: Get details about a client.GET /api/clientes/: Get list all clients.DELETE /api/clientes/id: Delete client with id.PUT /api/clientes/id: Update cliente with id.POST /api/ordenes/registrar: Register a new service order.GET /api/ordenes/id: Get details of an order.
-
Error handling:
ClientNotFoundException: It is launched when a client is not found.OrderNotFoundException: It is thrown when an order is not found.InvalidDataException: Thrown when input data is invalid.IdDuplicadoException: Thrown when attempting to register a duplicate ID.
src/
├── main/
│ ├── java/co/edu/JdA/
│ │ ├── Main.java
│ │ ├── controller/
│ │ │ ├── ClientController.java
│ │ │ └── OrderController.java
│ │ ├── DTO/
│ │ │ ├── ClientCreationDTO.java
│ │ │ ├── ClientResponseDTO.java
│ │ │ ├── OrderCreateDTO.java
│ │ │ └── OrderResponseDTO.java
│ │ ├── entity/
│ │ │ ├── ClientEntity.java
│ │ │ └── OrderEntity.java
│ │ ├── exception/
│ │ │ ├── ClientNotFoundException.java
│ │ │ ├── IdDuplicadoException.java
│ │ │ ├── InvalidDataException.java
│ │ │ └── OrderNotFoundException.java
│ │ ├── repository/
│ │ │ ├── ClientRepository.java
│ │ │ └── OrderRepository.java
│ │ └── service/
│ │ ├── ClientService.java
│ │ └── OrderService.java
│ └── resources/
│ ├── db/migration/
│ │ └── V2__add_registration_date.sql
│ └── application.properties
├── docs/
│ ├── UML-diagram.png
│ └── UML.plantuml
└── docker/
└── V1__init.sql
This project is licensed under the MIT License. See the LICENSE file for details.
