@AspectJ pointcut for all methods inside package
How about one of these alternatives?
A) General execution pointcut with package restrictions:
execution(* *(..)) &&( within(com.abc.xyz..controller..*) || within(com.abc.xyz..service..*) || within(com.abc.xyz..dao..*))
B) Package-restricted execution pointcuts:
execution(* com.abc.xyz..controller..*(..)) ||execution(* com.abc.xyz..service..*(..)) ||execution(* com.abc.xyz..dao..*(..))
I prefer B, by the way, just because it is a bit shorter and easier to read. As you have probably guessed, the ..
notation means "any package or subpackage", whereas *
at the end of the expression after ..
means "any method in any class".
You just need to change your point cut to something like this :
@Pointcut("within(com.abc.*)")
Further reading - https://docs.spring.io/spring/docs/2.0.x/reference/aop.html
Another alternative is to use
@Pointcut("bean(*Controller)")
But naming of your beans should be corresponding