Hi,

Please update the documentation to reflect the actual behavior:

In case of Proxies create by CGLIB it is stated that:

CGLIB proxies intercept only public method calls! Do not call non-public methods on such a proxy. They are not delegated to the actual scoped target object.

But this is not true, CGLIB proxies created by Spring-AOP mechanism can in fact intercept non-public methods too (protected and package-default). Probably this claim should be better off as a "recommendation".

This claim is found under: PDF Spring Framework Reference Documentation 5.0.0.M1 page 55

Also under current reference (from today): https://docs.spring.io/spring/docs/current/spring-framework-reference/core.html#beans-factory-scopes-other-injection

Similar claim occurrence:

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 have come across this while studying for the Spring Core Certification and tested it myself. See also other opinions: https://stackoverflow.com/questions/53717707/spring-cglib-proxies-intercept-only-public-method-calls

Best regards,

Georgian Dumitrache

Comment From: snicoll

@gdumitrache good catch and sorry it took so long to proceed. The second section has been rephrased in the meantime and I just did that for the first one.