Monthly Archives: January 2011

7 Business Requirements Often Forgotten By Grails Developers

I started working with Grails about three years ago. In that time, I have delivered seven different greenfield pure Grails applications for the wine, automotive and travel industries ( and inherited one fashion webapp ).

Working on our latest project, Secret Escapes, I realized that there were a few common business requirements that kept coming up in these projects but are not really taken into account in the ‘Get Started With Grails’ type books. Many of these rely on external services and integrations, which can be tricky and require the use of third party plugins.

In this post, I hope to summarize 8 business requirements that keep coming up in my experience building commercial Grails applications and some of the tools I’ve experimented with for these. Hopefully this will help you plan your next big app.

These usually fall into the ‘Site Maintenance / Admin / Refinement’ categories rather than the ‘Application Development’ categories, but are essential for business, marketing, and moving the site forward.

Continue reading

Working with the Grails Database Migration Plugin

I’ve recently spent some time exploring the new database migration plugin in Grails. Here are a few notes that I hope will help you out if you’re looking into using this plugin. Continue reading

Grails Interview Questions ( now with some Answers! )

In the vein of some Java Interview questions, I’ve started thinking of some Grails specific questions I could ask or be asked in job interviews. Here are some of my questions with some answers. Please feel free to submit your own questions or challenge my answers.


I have a parameter in my Config.groovy file named layer1.prop1. How can I access this in a controller? How can I access this in a service?
In a controller, I can inject grailsApplication via def grailsApplication and access this variable via grailsApplication.config.layer1.prop.

Anywhere else, I can use the ConfigurationHolder and access it via ConfigurationHolder.config.layer1.prop1

How do I edit the web.xml file of my grails application?
First, I need to generate the template files via grails install-templates. The web.xml template will be under src/templates/war directory.

Alternatively, I could also create a plugin and use the doWithWebDescriptor method to add or remove nodes from my web.xml file.

Explain the concept of externalized configuration. What is this good for?
Externalized configurations let me define other config and .properties files that don’t live within the grails-app/conf directory.

To enable this, I need to define locations for the application to look for configuration files via the grails.config.locations in Config.groovy in relation to the classpath or filesystem.

The most popular uses of externalized configurations is to enable configuration changes without having to re-build a war file. By planning ahead, configurations can even be reloaded without restarting the application container via this mechanism.

Please explain the difference between the Config.groovy and BuildConfig.groovy files.
The Config.groovy file contains configuration properties and information needed when running your application. It contains properties used by your services, controllers, etc.

The BuildConfig.groovy file contains information relevant to building and deploying your application, such as repositories, jar file dependencies and war file name.

Please explain what Bootstrap.groovy does.
Bootstrap.groovy allows you to define code that is ran every time your grails application starts up. Continue reading