grails metaprogramming
- by Don
Hi,
My understanding is that there are two obvious places in a Grails app where one can do meta-programming:
The init closure of Bootstrap.groovy
The doWithDynamicMethods closure of a plugin
The meta-programming I'm referring to here should be visible throughout the metaprogramming, typical examples include adding (or replacing) methods of 3rd party classes.
String.metaClass.myCustomMethod = { /* implementation omitted */ }
The disadvantage of (1), is that the metaprogramming won't be applied when the application is dynamically reloaded. The disadvantage of (2) is that I need to create and maintain an entire plugin just for the sake of a little metaprogramming.
Is there a better place to do this kind of metaprogramming?
Thanks,
Don