Search code examples
groovygriffon

It is possible to add another (chaining) invokeMethod to Groovy class?


I want to do AOP in Griffon's controller by using invokeMethod(), for example: add begin transaction advice to 'before' joint point and commit transaction advice to 'after' joint point in particular methods of all Griffon's controller.

I haven't verify this yet but I am afraid that the framework already has invokeMethod() for controller classes. Can I add a new invokeMethod() without affecting the previously defined invokeMethod() in a Groovy class? How to do that?


Solution

  • Griffon does enforce controllers to implement invokeMethod, you can provide your own. Another alternative would be to provide a custom implementation of the GriffonControllerActionManagerinterface

    http://griffon.codehaus.org/guide/latest/api/griffon/core/controller/GriffonControllerActionManager.html

    More information about this feature can be found at the Griffon Guide

    http://griffon.codehaus.org/guide/latest/guide/single.html#actionManager

    http://griffon.codehaus.org/guide/latest/guide/applicationOverview.html#managerConfiguration