I'm new to Grails and I'm using Grails 2.0.1. I want to add a persistence event listener for changes in objects for a domain class, so I tried the code in Bootstrap.groovy as given in the user guide:
def init = {
applicationContext.addApplicationListener(new FooBarListener())
}
And I get the following error message:
ERROR context.GrailsContextLoader - Error executing bootstraps: No such property: applicationContext for class: BootStrap
How can I get the applicacionContext property from inside the BootStrap class? or Is the documentation outdated and there is a new/better way to add domain changes listeners?.
Thanks in advance.
The shortest way I know is
applicacionContext must be defined in BootStrap. Following should work