Mostly Grails tips from Code Panda

Monthly Archives: January 2013

DropWizard is a really cool framework / library that allows you to quickly build production-ready HTTP+JSON REST services. It is built on mature libraries like Jetty, Jersey, Jackson and Metrics.

The framework bring together a lot of neat ideas for API monitoring like Health checks and simple application metrics via Metrics. DropWizard is very performant, claiming to be able to handle 15,000-20,000 requests per second. There is a pretty good video hailing the benefits of DropWizard here. The MongoDB-DropWizard slideshow is also very good to see what is possible with the framework.

Compared to Grails, DropWizard feels slightly more lightweight and perfect for services that don’t really have much of a front-end. DropWizard and JavaScript fat clients is the new black.

In this post, I will share how you can use Spock and Groovy instead of the Java / JUnit / Mockito examples provided by the DropWizard User Manual.

If you are not familiar with DropWizard or the testing of DropWizard applications, I suggest reading their Quick Start Guide and User Manual. I will use the Representations and Resources in the Testing DropWizard chapter of their user guide as the basis for this post.

Of the cool features of the Grails MongoDB gorm plugin is dynamic attributes – the ability to define properties in domain classes in an ad-hoc manner. This is actually quite cool since you can have very light domain classes in grails and keep your schemas fairly flexible.

In this post, I will show you how to use nested dynamic attributes with the grails mongodb plugin. Continue reading →