-
Notifications
You must be signed in to change notification settings - Fork 38.3k
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
CGLIB BeanCopier
falls back to ClassLoader.defineClass
for public target
#28699
Comments
public class AppTest {
@Test
public void test() {
BeanCopier copier = BeanCopier.create(A.class, B.class, false);
System.out.println("copier:" + copier);
}
}
class A {
}
class B {
} |
because your class not public class, you can try create public class A and B |
|
so, i wanna know that you add some param? |
|
can you show me the A class code ? |
|
i try many way to solve this problem, but any way had fail |
me too |
@mazhewei, thank you, your post was very helpful for me! |
I had a similar problem and after taking the answer from @mazhewei and @invzbl3 got it working. The main problem here could be a Intellij-Settings-Problem. For me following Setting for the argLine for the Tests with Maven was disabled. So when i runned the Test in the console with mvn clean install Test was ok but into IntelliJ was failed. Then i wrote in the pom.xml some configuration for the surefire plugin:
In my case, i have more package/module opened because of another tests but the point is after doing this i had not to write the add-opens package/module for the single test. Maybe @SuperEdison could try this solution and if all is fine issue could be close. |
我也遇到这种问题. 加了--add-opens也不好使. |
|
yes, i agree |
Same problem here. add a mark to be notified. |
BTW, I am using the latest version spring 6.0.12 |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as off-topic.
This comment was marked as off-topic.
It seems this is actually an issue with our context class patch which only works for non-public classes but not for public classes. I got a fix ready to be rolled into 6.0.14, to be backported to 5.3.31 as well. That said, please note that Spring's repackaged CGLIB fork is not meant to be used directly. Its primary role is supporting Spring's AOP framework and related core container functionality. We do not use CGLIB's |
ClassLoader.defineClass
for public target on JDK 17
ClassLoader.defineClass
for public target on JDK 17ClassLoader.defineClass
for public target
@jhoeller This is very good, looking forward to the official release of this version! |
This is available in the latest 6.0.14 snapshot now and will be available in the upcoming 5.3.31 snapshot in a few minutes (which can be obtained from repo.spring.io). Please give either of those a try ahead of our release date in November so that we have confidence that the fix works for good now. Alternatively, you could also patch a local Spring Framework setup with the latest |
ClassLoader.defineClass
for public targetBeanCopier
falls back to ClassLoader.defineClass
for public target
yep, spring could consider if that's deleted the cglib's 'BeanCopier' or using another way to support it |
For the time being, we are trying to make That said, I would appreciate early testing against 6.0.14 / 5.3.31 snapshot builds (from https://repo.spring.io) to verify that |
springframework.version 5.3.21
jdk.version 17
old issue #28530
I find this error still happening that is fault way to use?
@jhoeller
The text was updated successfully, but these errors were encountered: