Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

@pointcut doesn't work right

I realy get dangle. This code works fine:

@Before("execution(* *.runi(..))")
public void perform()
{
    sysout("hello");    
}

but this get exception:

@Pointcut("execution(* *.runi(..))")
public void perform()
{

}

@Before("perform()")
public void singerReport(Name name)
{
    sysout("hello");    
}

exception:

Initialization of bean failed; nested exception is java.lang.IllegalArgumentException: error at ::0 formal unbound in pointcut
like image 369
matina.Kapur Avatar asked Dec 14 '25 01:12

matina.Kapur


1 Answers

You can use somefing like:

@Pointcut("execution(* *.runi(com.yourproject.Name)) && args(name)")
public void perform(Name name){}

@Before("perform(com.yourproject.Name) && args(name)")
public void singerReport(Name name)
{
   sysout("hello");    
}
like image 170
Enginer Avatar answered Dec 15 '25 16:12

Enginer



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!