Skip to content

ResourcesClassLoader does not participate in CGLIB's cache #45065

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

Closed
snicoll opened this issue Apr 10, 2025 · 0 comments
Closed

ResourcesClassLoader does not participate in CGLIB's cache #45065

snicoll opened this issue Apr 10, 2025 · 0 comments
Assignees
Labels
type: task A general task
Milestone

Comments

@snicoll
Copy link
Member

snicoll commented Apr 10, 2025

When a test is modified to automatically include resources as introduced by #44444, a classloader is introduced that doesn't implement SmartClassLoader. As a result, any CGLIB proxy that's created by that test will not be recorded correctly.

This looks to test failures when a second test attempt to load the same proxy:

Caused by: java.lang.LinkageError: loader 'app' attempted duplicate class definition for org.springframework.boot.autoconfigure.graphql.security.GraphQlWebFluxSecurityAutoConfigurationTests$BookService$$SpringCGLIB$$0. (org.springframework.boot.autoconfigure.graphql.security.GraphQlWebFluxSecurityAutoConfigurationTests$BookService$$SpringCGLIB$$0 is in unnamed module of loader 'app')
    at java.base/java.lang.ClassLoader.defineClass0(Native Method)
    at java.base/java.lang.System$2.defineClass(System.java:2324)
    at java.base/java.lang.invoke.MethodHandles$Lookup$ClassDefiner.defineClass(MethodHandles.java:2439)
    at java.base/java.lang.invoke.MethodHandles$Lookup$ClassDefiner.defineClass(MethodHandles.java:2416)
    at java.base/java.lang.invoke.MethodHandles$Lookup.defineClass(MethodHandles.java:1843)
    at org.springframework.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:527)
@snicoll snicoll added the type: bug A general bug label Apr 10, 2025
@snicoll snicoll added this to the 3.3.11 milestone Apr 10, 2025
@snicoll snicoll self-assigned this Apr 10, 2025
@wilkinsona wilkinsona added type: task A general task and removed type: bug A general bug labels Apr 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: task A general task
Projects
None yet
Development

No branches or pull requests

2 participants