在 OSGi 中覆盖 Bundle 类加载器?

发布于 2024-09-30 17:08:41 字数 646 浏览 0 评论 0原文

这有可能吗?

我的意思是我自己的捆绑包?

谢谢 米莎

附注更具体地说,我感兴趣的是让我的包内的类(嗯,在片段内)从对

MyClass.class.getClassLoader()

的调用返回我的自定义类加载器而不是比捆绑的???

非常感谢

你的 米莎

附注我发现一些有用的链接似乎没有回答这个问题:(

http://shylendrabhat.com/blog/2009/11/21/class-loader-architecture-comparison-java-j2ee-and-osgi/

http://codescale.wordpress.com/2009/05/22/基础知识-关于-osgi-类加载/

Is this possible somehow?

I mean for my own bundle?

Thank you
Misha

p.s. More specifically, I am interesting in having a class within my bundle (well, within a fragment) return my custom classloader from a call to

MyClass.class.getClassLoader()

rather than the bundle's???

Thank you very much

Yours
Misha

p.s. Some helpful links I've found that don't seem to answer this question :(

http://shylendrabhat.com/blog/2009/11/21/class-loader-architecture-comparison-java-j2ee-and-osgi/

http://codescale.wordpress.com/2009/05/22/basics-about-osgi-classloading/

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

女中豪杰 2024-10-07 17:08:42

如果您使用 Equinox 作为 OSGi 实现,我认为您可以查看 类加载器挂钩

您可以查看 Equinox Transforms 的代码来了解如何贡献您的 hook。

If you're using Equinox as your OSGi implementation, I think you can have a look the classloader hook.

You can check out the code of Equinox Transforms to see how to contribute your hook.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文