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

Does not support lombok @Accessors(chain = true) #108

Closed
yeaicc opened this issue Aug 23, 2017 · 5 comments
Closed

Does not support lombok @Accessors(chain = true) #108

yeaicc opened this issue Aug 23, 2017 · 5 comments

Comments

@yeaicc
Copy link

yeaicc commented Aug 23, 2017

BeanCopier.create will throw exception when the source or target use @Accessors(chain = true) in lombok.
But org.springframework.beans.BeanUtils.copyProperties(source, target); has no problem.

java.lang.NullPointerException
	at net.sf.cglib.core.ReflectUtils.getMethodInfo(ReflectUtils.java:424)
	at net.sf.cglib.beans.BeanCopier$Generator.generateClass(BeanCopier.java:133)
	at net.sf.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25)
	at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:216)
	at net.sf.cglib.beans.BeanCopier$Generator.create(BeanCopier.java:90)
	at net.sf.cglib.beans.BeanCopier.create(BeanCopier.java:50)
@wangxi761
Copy link

Did you solve it?

@yeaicc
Copy link
Author

yeaicc commented Nov 22, 2018

use org.springframework.beans.BeanUtils.copyProperties(source, target);

@yeaicc yeaicc closed this as completed Nov 22, 2018
@friends110110
Copy link

But org.springframework.beans.BeanUtils.copyProperties(source, target); is another solution, so if still use cglib, how to do ?

@yangcoolq
Copy link

BeanCopier是基于ASM字节码增强做的,效率比Spring的要高很多 (仅次于硬编码)。不建议因为这个原因去用Spring或者apache的BeanUtils。还是老老实实用@builder

@tanyaofei
Copy link

use BeanCopier

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants