Archive for December 18th, 2012

An updated Grails Spring MVC Plugin

Tuesday, December 18th, 2012

The springmvc plugin was one of the first that I wrote. At the time it wasn’t possible to create controllers in Java, so the plugin added the feature as a way to migrate existing controllers from traditional Spring applications, or to use Java if Groovy performance is an issue. But direct support for annotated controllers was added in Grails 1.2 so that made the plugin redundant.

But I found when describing this feature for the Spring chapter of Programming Grails that all URLs end up with a .dispatch suffix. This has a workaround since you can re-map the URLs in UrlMappings.groovy but it’s not DRY since it has to be done for each URL. I saw this question on Stack Overflow and thought it’d be good to update the plugin since it allows the flexibility of using any URL suffix.

So I updated the plugin to work with Grails 2.0 and higher. See the plugin documentation for installation and configuration information. We’ll get the issues that the plugin addresses fixed in Grails, but that won’t happen until 2.3, so use this until then. You can download a sample application here.

For information on the history of the plugin, see the original post and the plugin announcement.

Creative Commons License
This work is licensed under a Creative Commons Attribution 3.0 License.