This is a Java 8 project for short URL creation and save it into mongodb database. It uses:
To run using maven just execute the following command:
mvn clean spring-boot:run
The default configuration to the mongoDB is localhost:27017, if it is running at other host or port you can run the application using:
mvn clean spring-boot:run -Dspring-boot.run.arguments=--spring.data.mongodb.host=<MONGODB_HOST>,--spring.data.mongodb.port=<MONGODB_PORT>
Or change the properties at application.yml file.
To generate the image from docker by maven just run:
mvn clean package docker:removeImage docker:build
To execute the application:
docker-compose [-f src/main/docker/docker-compose.yml] down && docker-compose [-f src/main/docker/docker-compose.yml] up -d
Viewing log:
docker logs -f docker_urlshortener-app_1
To see the API methods, run the application and go to:
http://localhost:8080/swagger-ui.html
Project Spring context settings.
Entities of the project.
Spring Data JPA repositories.
-
By default, they should extend MongoRepository<Entity, IDClass>.
-
It must end with the expression Repository.
REST Services Interfaces
-
Only DTOs should be exported.
-
It must end with the expression RestService.
Data Transfer Objects used to move the database data to the client.
REST Services Implementation
-
It must be annotated with @ RestController and @ RequestMapping ("/ api").
-
It must end with the expression RestServiceImpl.
Utility classes for generating REST services.
Interface of the services present in the project.
- It must end with the expression Service.
Concrete implementation of the services present in the project.
-
Manipulates DTOs and transforms them into the corresponding entity.
-
It must be annotated with @ Service.
-
It must end with the expression ServiceImpl.
DTO converter interface for entities.
-
It must extends EntityMapper<DTO, Entity>.
-
It must end with the expression Mapper.
Project Resources.
Spring configuration files.
- application.yml: Project Settings.
Test for the REST webservice and services project.
Configuration to execute the tests in this project.