In aspectj , can we have multiple pointcuts mapped to the single advice ?
for example below are two separate pointcuts
@Pointcut("execution(* xyz.get(..))")
void pointcut1() {
}
@Pointcut("execution(* abc.put(..))")
void pointcut2() {
}
so can anyone give idea how to configure these two pointcuts on a single advice ?
because for single pointcut to single advice like below we have
@Before("pointcut1()")
public void beforeLogging() {
System.out.println("Before Methods");
}
how to configure the same advice for multiple pointcuts ?
You can use the || operator. From the docs http://docs.spring.io/spring-framework/docs/current/spring-framework-reference/html/aop.html (9.2.2 Declaring an aspect):