Announcement Announcement Module
Collapse
No announcement yet.
pointcut args("name") is not working on the static dummy method Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • pointcut args("name") is not working on the static dummy method

    Hello everybody.
    I am learning Spring AOP and testing all its functionality.
    I sow something interesting.
    When declare pointcuts, I put all of them in one common class "SystemArchitecture" and put them on static dummy method so I can use them later on
    in all other aspects.
    Example:
    [code]
    @Component
    @Aspect
    public class SystemArchitecture {

    @Pointcut("execution(* set*(..))")
    public static void setterMethods(){}


    @Pointcut(value = "args(value)")
    public void allMethodsWithStringArguments(String value){}
    }
    [code]

    Later on my aspect class I call this pointcuts
    [code]

    @After("common.SystemArchitecture .allMethodsWithStringArguments(arg)" )
    public void methodsWithArgs(String arg){
    System.out.println("A method with 'String' arguments was executed.");
    System.out.print("The arg value: " + arg);
    }
    [code]

    The problem is that when I add this second pointcut "allMethodsWithStringArguments()" Spring throws an exception
    "Initialization of bean failed; nested exception is java.lang.ArrayIndexOutOfBoundsException: 1"
    Why is that happening?

    Thank is advice!

  • #2
    We are currently in the process of moving to stackoverflow.com for our forums. If you're still having this issue please consider asking it again at http://stackoverflow.com using the #spring tag. If you do post it there, please reply here with the link. Thanks!

    Comment

    Working...
    X