Table of Contents
Simple Spring project with a small REST API.
The project represents an ordering system that allows external users to order pilotes, a Majorcan recipe consisting of a meatball stew. Each time an order is created or modified, the project notifies the external system that will handle the cooking of the pilotes. Currently the notification system is handled just inserting the events in the database in JSON format, but this could be handled by sending the notifications to a message queue system, like RabbitMQ or Kafka.
The project includes an example implementation of some features like:
- REST controllers.
- OpenAPI documentation provided by springdoc-openapi-ui.
- A ControllerAdvice to handle error responses.
- A simple Spring security configuration using basic authentication to some endpoints.
- Database initialization both for DDL and sample data.
- Beans mapping using MapStruct.
- Getters, setters and builders generated with Lombok.
- Custom bean validations using java ConstraintValidation.
- A Maven Wrapper.
- RSQL library for filtering API and JPA queries
You will need Java JDK 11 to execute this project. You can use the distribution you prefer, if you don't have it installed yet, you can get the one provided by AdoptOpenJDK.
This project includes a maven wrapper, so you won't have to install Maven.
- Clone the repo
- Execute a Maven install to download all dependencies and construct the project:
./mvnw clean install
if you are using Linux or
mvnw.cmd clean install
if you are using Windows.
- Launch the application
./mvn spring-boot:run
You can create a docker image of the project by following this steps:
./mvnw clean package
docker build --tag pilotes-ordering:latest .
docker run -p8080:8080 pilotes-ordering
When the application launches, it already has a list of four clients already created to make testing easier. They have the following codes: 0001, 0002, 0003 and 0004.
Some endpoints are protected by a simple HttpBasic authorization. The user and password needed to access these endpoints are:
- user/userPass: with the role USER
- admin/adminPass: with the role ADMIN
API documentation can be accessed on http://localhost:8080/swagger-ui.html once you launch the application.
Distributed under the Apache License 2.0. See LICENSE file for more information
David Rodríguez Losada - [email protected] - LinkedIn