The UrBlog

John's Ramblings about Software Development

An Easier Way to Exclude Methods From Grails JMX Plugin Services

The Grails JMX plugin is a great way to quickly make a service available through JMX. Things get trickier when you want to only expose a few methods on the service. The plugin provides the option to list methods to exclude, but you need to list all of them including the ones Grails added to the service. Fortunately, we can use the metaclass to help us out. We can add a list of the few methods we want exposed and then use to that to generate the list of exclude method as follows: