Named Pointcut example!

For future reference!

PointCuts.java
import org.aspectj.lang.annotation.Pointcut;
 
public class Pointcuts {
    @Pointcut("target(biz.tugay.spashe.Foo))")
    public static void pcut(){}
}

BarImpl.java
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
 
@Aspect
public class BarImpl {
 
    @Around(value = "Pointcuts.pcut()")
    public Object bar(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {
        final long start = System.currentTimeMillis();
        final Object proceed = proceedingJoinPoint.proceed();
        final long end = System.currentTimeMillis();
        System.out.println(end - start);
        return proceed;
    }
}