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

Allow to avoid class validation in CglibAopProxy via ProxyFactory #27439

Closed
odrotbohm opened this issue Sep 20, 2021 · 1 comment
Closed

Allow to avoid class validation in CglibAopProxy via ProxyFactory #27439

odrotbohm opened this issue Sep 20, 2021 · 1 comment
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Milestone

Comments

@odrotbohm
Copy link
Member

In Spring HATEOAS we create proxies for the special purpose of recording method invocations on controllers. To do so, we have to proxy the return type of the controller method and those might contain final methods. Those trigger some log output in CglibAopProxy that the final methods cannot be properly intercepted. While this is very helpful information in general, in our special case it causes confusion with users to see this output because we will never actually invoke any method on the proxy but rather just inspect it via an introduced interface.

It would be nice to be able to configure the ProxyFactory in a way that it skips the class validation so that we can opt into that mode.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Sep 20, 2021
@jhoeller jhoeller self-assigned this Sep 20, 2021
@jhoeller jhoeller added in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Sep 20, 2021
@jhoeller jhoeller added this to the 5.3.11 milestone Sep 20, 2021
@jhoeller
Copy link
Contributor

I've made this part of our existing optimize flag which has a very general "perform aggressive optimizations" definition anyway. Previously that flag just enforced a CGLIB proxy similar to proxyTargetClass; now it also suppresses class validation and therefore actually makes a difference...

odrotbohm added a commit to spring-projects/spring-hateoas that referenced this issue Sep 21, 2021
We now explicitly set the optimize flag on the ProxyFactory for class based proxies used to create dummy invocation proxies. Still needs the upgrade to Spring Framework 5.3.11 (spring-projects/spring-framework#27439, #1647) to create full effect.
odrotbohm added a commit to spring-projects/spring-hateoas that referenced this issue Sep 21, 2021
We now explicitly set the optimize flag on the ProxyFactory for class based proxies used to create dummy invocation proxies. Still needs the upgrade to Spring Framework 5.3.11 (spring-projects/spring-framework#27439, #1647) to create full effect.
odrotbohm added a commit to spring-projects/spring-hateoas that referenced this issue Sep 21, 2021
We now explicitly set the optimize flag on the ProxyFactory for class based proxies used to create dummy invocation proxies. Still needs the upgrade to Spring Framework 5.3.11 (spring-projects/spring-framework#27439, #1647) to create full effect.
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) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

3 participants