Aspect J will solve your problem.
Try defining a pointcut as follows:
pointcut profilling(): execution(public * *(..)) && (
within(com.myPackage..*) ||
This way you will catch the entire invocation of any public method in the com.myPackage package. Add as many sentences inside that you need.
Then add the following code:
Object around(): profilling() {
proceed();
}
IF you want to know more about aspect J, follow this guide .
source
share