Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect reference information about CGLIB supported method visibility #25001

Closed
gdumitrache opened this issue May 1, 2020 · 1 comment
Closed
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: backported An issue that has been backported to maintenance branches type: documentation A documentation task
Milestone

Comments

@gdumitrache
Copy link

gdumitrache commented May 1, 2020

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

@gdumitrache gdumitrache changed the title Incorrect information in Incorrect reference information about CGLIB supported method visibility May 1, 2020
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label May 1, 2020
@rstoyanchev rstoyanchev added the in: core Issues in core modules (aop, beans, core, context, expression) label Nov 10, 2021
@snicoll snicoll added type: documentation A documentation task for: backport-to-5.3.x Marks an issue as a candidate for backport to 5.3.x and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Sep 25, 2023
@snicoll snicoll added this to the 6.0.13 milestone Sep 25, 2023
@snicoll snicoll self-assigned this Sep 25, 2023
@github-actions github-actions bot added status: backported An issue that has been backported to maintenance branches and removed for: backport-to-5.3.x Marks an issue as a candidate for backport to 5.3.x labels Sep 25, 2023
@snicoll
Copy link
Member

snicoll commented Sep 25, 2023

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: backported An issue that has been backported to maintenance branches type: documentation A documentation task
Projects
None yet
Development

No branches or pull requests

4 participants