- About
- Architecture
- Technologies
- Swagger Documentation
- Security
- How to run
- how to run Test
- Contributors
This is a Rest API developed based on the requirements given for the selection process by the company W2M. This API was built with Java 21, Spring Boot, H2 Database, Flyway Migration, Spring Doc OpenAPI, Docker and Docker-compose.
The application is built following the MVC design pattern. Each of the components will be described below:
- View: contains response from the Rest controller that will be shown in JSON format to the client.
- Rest Controller: responsible for receiving calls and directing them to the correct service.
- Service: a design pattern layer responsible for calling the service from the repository layer.
- Repository: this layer is responsible for connecting to the database and for persisting, retrieving, updating and deleting data.
- Java 21
- Spring Boot 3.2.2
- Spring Security - Basic Authentication
- Spring OpenAPI
- H2 Database
- Flyway Migration
- Docker
- Docker-compose
- AssertJ, Mockito
The documentation is generated by Spring Openapi. Once you have started the application the url: http://localhost:8080/swagger-ui.html
This API is protected with Spring Security using basic authorization.
This API is configured to not save sessions.
Once you have accessed Swagger, simply authenticate with your username and password.
Notes: Basic authorization mode is not recommended, as it is not the most secure.
When starting the application, a user user: admin password:1234
with the admin role will already be available.
There two options to run this application, run by docker-compose or run as spring-boot.
Make sure you have Docker installed and execute the command.
docker-compose up
mvn spring-boot:run
This application has unity tests and integration tests, once it use Maven just run:
mvn test