本文介绍了如何在不同的类加载器之间共享对象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要不同的类加载器才能卸载类。但我需要在它们之间共享对象(实际上我得到的是ClassCastException)。那么解决这个问题的解决方案是什么?谢谢

I need different classloaders to be able to unload classes. But i need to share objects between them (actually i am getting ClassCastException). So what are the solutions to deal with this?. Thanks

推荐答案

来自不同类加载器的对象可以通过通用类加载器加载的接口和类相互交互。

Objects from different classloaders can interact with each other through interfaces and classes loaded by a common classloader.

这篇关于如何在不同的类加载器之间共享对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 19:33