Migrating DropWizard From 0.7.x to 0.8.0

Java Open Source XChart Library

XChart features a dead-simple API for turning your data into beautiful charts including line, scatter, area, pie, donut, bubble, stick, bar, and histogram charts. Extra features include: real-time, themes, CSV import and export, export as PNG, JPG, BMP, GIF, SVG, EPS and PDF and much much more. For full description and examples visit the project on Github!

Migrating to Dropwizard version 0.8.0 was easier than the update from 0.6.x to 0.7.0, but there were still some hang ups, so I thought I would share some of the migration changes need for upgrading to the latest release of from version 0.7.x. The Release notes are a good place to start, but beyond that any hints or guides for upgrading are pretty sparse. This will not be a complete guide and will only cover the specific issues I had to deal with. A working example is availbale at our GitHub project called XDropWizard. XDropWizard is a jump-start web application integrating and demonstrating several useful open source projects such as Yank, Sundial (a Quartz fork), Flot, Bootstrap, AngularJS, HSQLDB, XChart, JUnit, etc., and demonstrates how to serve static content, dynamic content loaded into Freemarker templates, using AJAX and more. The README file has clear instructions on how to build and deploy the app using Maven as well as explanations for how to integrate a plethora of capabilities into a Dropwizard-based web application and web service.

Default service URL

In the case where you want to change the default API base URL to something other than / there is a setting for that. Previously it was set in Java code, and now it’s set in the YML config file. Below is a snippet from XDropWizard.

Before (Version 0.7.x)

After (Version 0.8.0)

YAML

1

2

3

4

5

6

7

8

9

server:

type: simple

rootPath: '/service/*'

applicationContextPath: /

adminContextPath: /admin

connector:

type: http

port: 9090

...

ViewBundle

Before version 0.8.0, ViewBundle was a concrete class and you could new-up an instance of it and be done. Now ViewBundle is an abstract class so you need to new it up and implement it’s one abstract method. Below is a snippet from XDropWizard.