Java SPI 模块中的激活是如何发生的?

发布于 2025-01-20 18:20:04 字数 445 浏览 5 评论 0原文

我正在处理将OSGI模块迁移到Java SPI模块的任务。假设我有三个OSGI(A,B,C)模块。因此,每个模块都有一个用于激活和激活的类时(在开始时)。服务注册和激活(@Acctivate)类上的其他必需方法执行。服务,服务实施和服务注册包含在同一模块中。

但是当迁移时,我有一些问题,

1)每个OSGI模块都有不同的类路径。因此,我可以为不同的模块具有不同版本的依赖罐(a -aaa.jar(1.0),b -aaa.jar(version -2.0)。但是所有SPI模块都会在同一类路径中加载。 在Java Spi中,是否可以使用不同的模块的依赖性罐子?

我们没有激活类。服务加载程序将加载服务实现。这是懒惰的Java SPI的解决方案吗?

3)正如我之前提到的。 OSGI激活类中正在发生其他一些方法执行。因此,当捆绑激活发生(启动服务器)时,它将执行这些方法。SPI模块中的解决方案(没有激活类)可以是什么?

I am working on a task that migrates the OSGI modules to Java SPI modules. Let's say I have three OSGI(A, B, C) modules. So each module has a class for activation and activation happening when starting the servers(at the beginning). Service registration and some other required method executions happening on the activation(@acctivate) class. Service, Service implementation, and Service registration are included in the same module.

but when migrating I have some questions,

1)Each OSGI module has a different class path. Therefore I can have different versions of dependency jars for the different modules ( A - aaa.jar(version-1.0), B - aaa.jar(version-2.0). But all the SPI modules will load in the same class path. So is it possible to have different versions of dependency jars for the different modules?

2)In Java SPI we don't have an activation class. Service loader is to load service implementations. is this lazy loading the solution for java SPI?

3)As I mentioned earlier. Some other method executions are happening in the OSGi activation class. So it will execute those methods when bundle activation happens(Starting the server ).what can be the solution in SPI modules(there is no activation class)?

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

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

发布评论

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