2

I am using spring AOP to intercept the methods. I have below configuration in my spring config file.

<aop:aspectj-autoproxy />

Aspect class:

@Aspect
public class MyAspect{

 @Around("execution(public * *(..))")
public Object doAction(ProceedingJoinPoint call) throws Throwable {

 //somelogic
}

Above method does not intercept private methods ? what should i do to ask the aspect to intercept both private and public methods?

user3269829
  • 131
  • 2
  • 11

1 Answers1

5

Private methods may not be intercepted, as they may not be invoked through a proxy.

However, you could use native AspectJ weaving, as you can see on the point 8.8.4 of the following page:

http://docs.spring.io/spring/docs/4.0.0.RELEASE/spring-framework-reference/html/aop.html#aop-pointcuts-designators

Andres
  • 10,561
  • 4
  • 45
  • 63