我是 Grails 新手,我正在使用 Grails 2.0.1。我想为域类的对象更改添加持久性事件侦听器,因此我尝试了用户指南中给出的 Bootstrap.groovy 中的代码:
def init = {
applicationContext.addApplicationListener(new FooBarListener())
}
我收到以下错误消息:
错误 context.GrailsContextLoader - 执行引导程序时出错:没有这样的属性:类的 applicationContext:BootStrap
如何从 BootStrap 类中获取applicacionContext属性?或者文档是否过时并且有一种新的/更好的方法来添加域更改侦听器?
提前致谢。