Lazybone Dropwizard Turbo template
Turbo charge your Dropwizard 0.8.0 Microservice using this lazybones template, inspired by KyleBoon's Lazybones Template for Dropwizard 0.7.0
For more instructions on lazybones( Project Creation tool) and how to build this project refer to: Lazy Bones and Template developer guide
Purpose
There are many Dropwizard Modules available to extend from. However sometimes it may be difficult for all modules to play well together. This templates aims to pull together various essential modules we came across in our day to day projects and present them as a stable integrated bundle together with unit/integration tests.
The resultant project is tailored towards the following usages (see Tech Stack below for more details):
- dependency injection - use Guice auto config to avoid boilerplate code.
- containerised deployment - Docker or Heroku containers: single port and ENV variables available during runtime only
- continuous delivery - application version is not hardcoded but passed in at build time via gradle property:
-Papp_version
- Java8 - lambdas, Optional and LocalDate.
The result project will also mark certain modules and dependencies as optional, they can be deleted based on your needs.
Usage
Install lazybones using gvm
gvm install lazybones
Update lazybones config to point to trunkplatform lazybones repository:
lazybones config set bintrayRepositories "pledbrook/lazybones-templates", "trunkplatform/lazybones"
Create new Project
Make sure you are using lazybones 0.8+
lazybones create dropwizard-turbo {version} destination
Make sure you set your IDE to Java1.8 when importing this project.
Build from source
If you wish to build from source or make contributions to this project:
gradle packageTemplateDropwizardTurbo
gradle installAllTemplates
That will create the template and install it to your local lazybones cache. After that you can use the template as you would normally.
Tech Stack
Most of the following dependencies are optional. Mix and match as you see fit.
Official Modules:
- Dropwizard Hibernate - database ORM
- Dropwizard Migrations - liquibase migration. Also see
gradle/migrations.gradle
- Dropwizard Jersey Client - to connect with other REST API endpoints.
- Dropwizard Java8
- Dropwizard Java8 Authentication
Third Party Modules:
- Dropwizard Guice - DI and auto configures resources, healthcheck, tasks, managed, jersey providers.
- Governator - lazy singleton and life cycle management.
- Dropwizard Template Configuration - swaps in environment variables using freemarker templating.
- Swagger - interactive documentation
Helpers:
- Pact Gradle - consumer driven contract testing using Pact. See
gradle/pact.gradle
- NewRelic - for monitoring. See
gradle/newrelic.gradle
- Docker - Includes sample Dockerfile.
- Dropwizard Testing - sample Resource and Integration tests provided
- Shadow - building exectutable fatjar. See
gradle/shadow.gradle
- CORS Filter - CORS implementation using Jersey
ContainerResponseFilter