I am using Spring AOP and have below aspect:
@Aspect
public class LoggingAspect {
@Before(\"execution(* com.mkyong.customer.bo.CustomerBo.addCustomer(..
You have a few options:
First, you can use the JoinPoint#getArgs() method which returns an Object[]
containing all the arguments of the advised method. You might have to do some casting depending on what you want to do with them.
Second, you can use the args
pointcut expression like so:
// use '..' in the args expression if you have zero or more parameters at that point
@Before("execution(* com.mkyong.customer.bo.CustomerBo.addCustomer(..)) && args(yourString,..)")
then your method can instead be defined as
public void logBefore(JoinPoint joinPoint, String yourString)
If it's a single String argument, do:
joinPoint.getArgs()[0];