Announcement Announcement Module
No announcement yet.
AOP with AbstractAction execute method Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • AOP with AbstractAction execute method

    I was attempting to set up an aspect on one of the classes extending AbstractAction (SWF - package org.springframework.webflow.action) on the public final method execute.

    The execute is the only public method in the interface Action class It's signature is: public abstract Event execute(RequestContext requestcontext) throws Exception;

    Now I have tried to define the pointcut in the following ways but it is still not getting invoked.

    (1) @After("execution(* com.tester.SampleAction.*(..))")

    (2) @After("execution(public final org.springframework.webflow.execution.Event org.springframework.webflow.action.AbstractAction. execute(..))")

    (3) @After("execution (public final org.springframework.webflow.execution.Event org.springframework.webflow.action.AbstractAction. *(..))")

    (4) @After("execution (public final * org.springframework.webflow.action.AbstractAction. *(..))")

    The execute method is defined the AbstractAction class.
    I have checked that in my Aspect class other aspects are being correctly invoked. (So there is not configuration issue from spring side). I am using the runtime weaving in Spring for AOP. ( I assume Spring would be using Java dynamic proxy for this internally since an interface exists)

    Please suggest the right pointcut definition?

  • #2
    The first one should match, if you use the AbstractAction you might want to include + sign (meaning any subclass or implementation in case of an interface).

    Also make sure you only have 1 aop:config block not multiple because then you will be proxying proxies which might cause your aspects not to match.