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

BeanCopierUtil 实现替换 #530

Open
sage417 opened this issue Feb 17, 2025 · 1 comment
Open

BeanCopierUtil 实现替换 #530

sage417 opened this issue Feb 17, 2025 · 1 comment
Labels

Comments

@sage417
Copy link

sage417 commented Feb 17, 2025

方案描述

原先方案使用cglib进行bean deep copy,但是cglib已经停止维护,jdk17+copy时报错,
建议数据对象通过json序列化方式实现deep copy,可选gson/jackson等
建议非数据对象通过hard code 方式deep copy

应用场景

gson deep copy example: gson.fromJson(gson.toJson(source), targetClazz);

难度风险

难度低,影响四处copy逻辑和告警通知相关,风险可控

影响代码

  • org.dromara.dynamictp.core.monitor.collector.MicroMeterCollector#collect threadpool 监控数据 使用序列化方式
  • org.dromara.dynamictp.core.monitor.collector.jmx.JMXCollector#collect threadpool 监控数据 使用序列化方式
  • org.dromara.dynamictp.core.notifier.AbstractDtpNotifier#newTargetPlatform 告警配置 使用序列化方式
  • org.dromara.dynamictp.core.support.ExecutorWrapper#capture maybe hard code ?

外部依赖

删除cglib,增加gson依赖

@KamToHung
Copy link
Collaborator

加运行参数 --add-opens java.base/java.lang=ALL-UNNAMED,现在不少项目还是用到反射的,如果后续修改我觉得如果可以自己new会更好(性能差了点),或者用下mapstruct

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

No branches or pull requests

2 participants