Entity-attribute-value (EAV) model implementation based on car. Cars in EAV model are kept in a rational database (embedded H2). Attributes together with basic fields are also kept in a document database (embedded MongoDB) to support faster search operations.
Application can be run as fat jar and RESTful API is available.
- Java 8
Default port is 8888. It can be changed in application.yaml if needed.
For Windows use gradlew.bat
$ ./gradlew bootRun
$ ./gradlew build
$ java -jar build/libs/cars.jar
$ curl localhost:8888/info
{
"app": {
"description": "RESTful web service for storing cars",
"name": "cars",
"version": "0.1"
},
"git": {
"branch": "master",
"commit": {
"id": "f08244c",
"time": "\"Tue Mar 24 23:51:47 2015 +0100\""
}
}
}
Documentation is generated by Swagger and is available under main site. For local run it can be found here
Example car in json format which can be stored in system:
{
"make": "Opel",
"model": "Corsa",
"year": 2010,
"engineDisplacement": 1300,
"attributes": {
"origin": "Poland",
"speed": "fast"
}
}
Example search filter:
{
"year": 2010,
"speed": "fast"
}
- back-end: Java 8, Spring Boot, Spring Data, JPA with Hibernate, embedded H2, embedded MongoDB, Lombok, Logback
- testing: Spock
- building: gradle, Travis
- code quality: JaCoCo, coveralls
All Spring Boot Actuator endpoints are turned on and are available at server port. It is convenience when testing, but not recommended in production.
Embedded H2 and MongoDB databases are used for easy setup.