Juergen Hoeller opened SPR-14515 and commented

Following up on #19047, we should once again consider changing the default proxy mode to target-class (CGLIB)...


Affects: 5.0 M1

Issue Links: - #19047 Mis-proxying of Mockito mock and poor diagnostics for type mismatch on proxy injection - #8346 Add support for mixed, fine-grained JDK- and CGLIB-based proxying - #18894 CGLIB proxies should still consider @Transactional annotations on interface methods

Comment From: spring-projects-issues

Willian Constâncio da Silva commented

Maybe #8346 is a related issue.

Comment From: jhoeller

Aside from Spring Boot's default target-class choice for high-level proxy functionality there, I don't see us ever changing this in the core framework facilities. At that level, this is effectively an independent setting for every proxy factory and would break many assumptions in scenarios that are hard to fix.

Also, in native images and similar scenarios, it actually turned out to be beneficial to aim for interface-based proxies wherever possible. Even for configuration classes, the "lite" mode (proxyBeanMethods=false) is rather recommendable for library components now, avoiding unnecessary class generation.