Welcome to the world of dropwizard. With this example, you'll have an simple, fully instrumented "Hello, World" application up and running in minutes. Let's do it.
Make sure you have simple-build-tool installed.
-
Clone this example repo.
git clone https://github.com/codahale/dropwizard-example.git
-
cd
into the new directory. -
Now we'll easily build a fat JAR of our project and its dependencies. The
sbt assembly
command uses assembly-sbt (included with dropwizard) to handle the hard work. That JAR should end up somewhere liketarget/scala_2.8.1/dropwizard-example-assembly-1.0-SNAPSHOT.jar
sbt update sbt assembly
-
Start the HTTP server, using the provided configuration file.
java -jar target/scala_2.8.1/dropwizard-example-assembly-1.0-SNAPSHOT.jar server example.conf.template
-
Open up your browser and point it at
http://localhost:8080/hello-world
. Boom. -
Throw in a query parameter.
http://localhost:8080/hello-world?name=Martin
. The id is auto-incremented and the given name will appear. -
Now for the really fun part. Point your browser to
http://localhost:8081/
and you'll find operational data, health checks, and more. Dropwizard ships with metrics, which provides tons of valuable data about your application and its production environment. -
And now go build some awesome services.