In Spring we can share common pointcut definitions like below
@Aspect
public class SystemArchitecture {
/**
* A join point is in the web layer if the method is defined
* in a type in the com.xyz.someapp.web package or any sub-package
* under that.
*/
@Pointcut("within(com.xyz.someapp.web..*)")
public void inWebLayer() {}
}
And the above can be used like below
@Aspect
public class MyAspect {
@AfterThrowing(pointcut = "inWebLayer() ")
public void processError(JoinPoint jp) {
logger.info("Enter:processError");
}
}
Is it possible to pass the jointpoint to the share point cut definition .
Something like below where myCustomCheck is another shared point cut definition which checks something based on the jointpoint passed to it.
@Aspect
public class MyAspect {
@AfterThrowing(pointcut = "inWebLayer() && myCustomCheck(jp) ")
public void processError(JoinPoint jp) {
logger.info("Enter:processError");
}
}
Is this feasible ?
Thanks
Lives.