Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pauloportugal/dropwizard-guice-jpa
Simple Dropwizard GuicePersist application using Hibernate as the JPA implementation
https://github.com/pauloportugal/dropwizard-guice-jpa
dropwizard guice h2-database hibernate java jpa microservice rest-assured swagger swagger-ui
Last synced: 2 days ago
JSON representation
Simple Dropwizard GuicePersist application using Hibernate as the JPA implementation
- Host: GitHub
- URL: https://github.com/pauloportugal/dropwizard-guice-jpa
- Owner: PauloPortugal
- License: mit
- Created: 2017-04-05T00:18:27.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2022-03-13T19:10:32.000Z (almost 3 years ago)
- Last Synced: 2024-12-19T23:26:46.897Z (about 2 months ago)
- Topics: dropwizard, guice, h2-database, hibernate, java, jpa, microservice, rest-assured, swagger, swagger-ui
- Language: Java
- Size: 46.9 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![Build Status](https://travis-ci.org/PauloPortugal/dropwizard-guice-jpa.png)](https://travis-ci.org/PauloPortugal/dropwizard-guice-jpa.svg?branch=master) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/82869bd865d74a09bee564cc761c831a)](https://www.codacy.com/app/PauloPortugal/dropwizard-guice-jpa?utm_source=github.com&utm_medium=referral&utm_content=PauloPortugal/dropwizard-guice-jpa&utm_campaign=Badge_Grade) [![Coverage Status](https://coveralls.io/repos/github/PauloPortugal/dropwizard-guice-jpa/badge.svg?branch=master)](https://coveralls.io/github/PauloPortugal/dropwizard-guice-jpa?branch=master)
# Dropwizard Guice and JPA application
This a dockerized RESTful Dropwizard application, to provide an example on how to integrate JPA in Dropwizard, using dependency injection.
The example is a simple RESTful interface to easily manage a task planner.- using [Dropwizard](https://dropwizard.github.io/dropwizard/) v1.1.0 framework
- dependency injection achieve through [Google Guice](https://code.google.com/p/google-guice/)
- JPA implementation through [Hibernate](http://hibernate.org/)
- [H2](http://http://www.h2database.com/) as an in-memory database
- [rest-assured](https://code.google.com/p/rest-assured/) for the integration tests
- API documentation provided by [swagger.io](http://swagger.io//) and [swagger UI](http://swagger.io/swagger-ui/)
- Database migrations provided by [FlywayDB](https://flywaydb.org/)
- [Docker](https://www.docker.com/) as the containerisation solution
- using [Hate](https://github.com/blackdoor/hate) library as HATEOAS with HAL implementationHow to start the DropwizardGuice application
---1. Run `mvn clean verify` to build your application
1. Start application with `java -jar target/dropwizard-guice-1.0-SNAPSHOT-uber.jar server target/config.yml`
1. To check that the application is running enter url `http://localhost:8080`
1. To interact with the application using Swagger UI endpoints enter url `http://localhost:8080/swagger`
1. To run the application inside a docker container, `./docker-run.sh`
### Creates a new task
```
POST /tasks
```#### Description
Creates a new task. Task descriptions are not unique.#### Parameters
|Type|Name|Description|Schema|
|---|---|---|---|
|**Body**|**body**
*required*|payload|[Task Entity](#task-entity)|#### Responses
|HTTP Code|Description|Schema|
|---|---|---|
|**201**|Created|[Task Entity](#task-entity)|#### Consumes
* `application/json`
#### Produces
* `application/json`
### Get all the tasks
```
GET /tasks
```#### Description
Returns all the tasks save on the database#### Responses
|HTTP Code|Schema|
|---|---|
|**200**|< [Task Entity](#task-entity) > array|#### Produces
* `application/json`
### Get task by id
```
GET /tasks/{taskId}
```#### Description
Returns task by Id. If it does not exist it will return a HTTP 404#### Parameters
|Type|Name|Description|Schema|
|---|---|---|---|
|**Path**|**taskId**
*required*|taskId|integer(int64)|#### Responses
|HTTP Code|Description|Schema|
|---|---|---|
|**200**||[Task Entity](#task-entity)|
|**404**|Not Found|No Content|#### Produces
* `application/json`
### Updates task by id
```
PUT /tasks/{taskId}
```#### Description
Updates a task description if available in the database#### Parameters
|Type|Name|Description|Schema|
|---|---|---|---|
|**Path**|**taskId**
*required*|taskId|integer(int64)|
|**Body**|**body**
*required*|payload|[Task Entity](#task-entity)|#### Responses
|HTTP Code|Description|Schema|
|---|---|---|
|**200**|Updated|No Content|
|**404**|Not Found|No Content|#### Consumes
* `application/json`
#### Produces
* `application/json`
### Deletes task by id
```
DELETE /tasks/{taskId}
```#### Description
Deletes a if available in the database#### Parameters
|Type|Name|Description|Schema|
|---|---|---|---|
|**Path**|**taskId**
*required*|taskId|integer(int64)|#### Responses
|HTTP Code|Description|Schema|
|---|---|---|
|**204**|No Content|No Content|
|**404**|Not Found|No Content|#### Consumes
* `application/json`
#### Produces
* `application/json`