From the Spring doc:
6.2.3.4. Examples
Spring AOP users are likely to use the execution pointcut designator the most often. The format of an execution
expression is:execution(modifiers-pattern? ret-type-pattern
declaring-type-pattern? name-pattern(param-pattern)
throws-pattern?)
I can see the modifiers-pattern? where you can say public, private, protected. And on the same document it says:
6.2.3.1. Supported Pointcut Designators
Due to the proxy-based nature of Spring’s AOP framework, protected methods are by definition not
intercepted, neither for JDK proxies (where this isn’t applicable) nor
for CGLIB proxies (where this is technically possible but not
recommendable for AOP purposes). As a consequence, any given pointcut
will be matched against public methods only!
I’m abit confused, what is the point of using the modifiers-pattern?, please give an example?
That documentation is now out of date. The latest is at https://docs.spring.io/spring-framework/docs/current/spring-framework-reference/core.html#aop-pointcuts-designators and says
So be careful with non-public access modifiers, but you can use them in certain scenarios with cglib proxies.