I perform an audit for my level of "Controller", "Service" and "Tao". I have three Around aspect functions for Controller, Service and Dao respectively. I use a custom annotation, which, if present in the Controller method, calls the Around aspect function. Inside the annotation, I set the property that I want to pass from the Controller Around function to the Service function around the Aspect class.
public @interface Audit{
String getType();
}
I set the value of this getType from the interface.
@Around("execution(* com.abc.controller..*.*(..)) && @annotation(audit)")
public Object controllerAround(ProceedingJoinPoint pjp, Audit audit){
}
@Around("execution(* com.abc.service..*.*(..))")
public Object serviceAround(ProceedingJoinPoint pjp){
}
How to transfer an object between two Around functions?
source
share