-
Notifications
You must be signed in to change notification settings - Fork 38.5k
CGLIB: duplicate class definition when testing proxy classes in a dedicated servlet on Java 17 #27968
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
Comments
Indeed, this effectively a duplicate of #25940.
I don't see any code in that repo. There's only a README file. |
Really silly of me, I forgot to also push the classes 🤦. I have pushed the changes there now as well. Let me know what you think and whether this is something that can be addresses in Spring 5, the other issue is targeted towards Spring 6.
That's why I expected, but wanted to make sure. |
Hi @filiphr, Thanks for adding the code to your repo. We will take that into account when investigating this issue, which we plan to do in conjunction with #25940.
We do not currently have any plans to address this in 5.3.x, but we will reassess that if we do something for 6.0.x. I am therefore closing this as a duplicate of #25940. |
Thanks for letting me know @sbrannen. I am going to look for an alternative way to solve the problem that we are facing. |
@filiphr what was the approach you took to solve this problem? |
@mxhc we are not using CGLIB proxies. This means that we created interfaces and then classes implementing those interface. If it is done like that they it works |
We are in the process of making our application run on Java 17 using Spring Boot 2.6 and Spring Framework 5.3.
We have a test setup where we register our web endpoints in different servlets. We do this by using the
ServletRegistrationBean
from Spring Boot and create aDispatcherServlet
using anAnnotationConfigWebApplicationContext
.A linkage error occurs when we try to have different tests with different configuration, i.e. each test will create its own application context.
I have created a small project showcasing this problem (https://github.com/filiphr/spring-java-17-duplicate-class-definition).
The main error is
I have also found #25940 which looks like it has the same cause for the problem. However, I believe that my example is slightly less complicated.
Is it possible for Spring to do something and not create duplicate class definitions and create unique class names per application context as commented by @iherasymenko in #25940 (comment)?
The text was updated successfully, but these errors were encountered: