Announcement Announcement Module
No announcement yet.
pointcut args("name") is not working on the static dummy method Page Title Module
Move Remove Collapse
Conversation Detail Module
  • 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.
    public class SystemArchitecture {

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

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

    Later on my aspect class I call this pointcuts

    @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);

    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 for our forums. If you're still having this issue please consider asking it again at using the #spring tag. If you do post it there, please reply here with the link. Thanks!