如何在其他项目中获取应用程序context

发布于 2025-02-07 04:28:26 字数 244 浏览 1 评论 0原文

我有两个春季项目,我想在其中一个项目中获取另一个项目的应用程序对象。我应该怎么做?

我想使用ASM来增强SpringApplication类,但是JVM运行时不支持添加字段和方法(DCEVM除外,但我使用的是Hotspot),所以我考虑过修改JAR文件,但我无法修改它。

如果我使用JMX做到这一点,这是一个很好的解决方案吗? 我尝试使用JMX,但他无法公开ApplicationContext对象。

我试图使用JNI方法来实现它。

I have two spring projects, and I want to get the applicationContext object of the other project in one of the projects. How should I do it?

I want to use asm to enhance the SpringApplication class, but the jvm runtime doesn't support adding fields and methods (except dcevm, but I'm using hotspot), so I thought about modifying the jar file, but I can't modify it.

Would it be a good solution if I use jmx to do it?
I tried to use jmx but he can't expose ApplicationContext object.

I tried to use jni method to achieve it.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文