In package com.repository I have :
I would like to measure execution time of all methods from com.repository package (communication with database). But I would like to avoid duplications
now with
@Pointcut("execution(public * com.repository..(..))")
I have some methods logged twice - from interface and from class implementing this interface. I would like either not to log methods from interfaces which have implementing class in the same package, or not to log methods from classes which implement interface from the same package.
How can I express it with pointcut and advice?
My question is a bit related to AspectJ : Issue when combining multiple pointcuts in @Around advice, but it doesn't solve my problem.
If the objects you're monitoring are located to a specific package, why you don't bound the pointcut only to that package.
So use
@Pointcut("execution(* com.repository.*.*(..))")
instead of
@Pointcut("execution(public * com.repository..*.*(..))")
which include "com.repository" package and all its sub packages.