2

我正在为 OSGi 开发 Spring,也就是 Eclipse Gemini Blueprint。

我发现的每个教程或文档都提到将 Spring 提供的几个包添加到我的 OSGi 容器(如org.springframework.aop.jar)。很难找到当前 Spring 版本的下载,因为它似乎不再直接在他们的主页上提供(只有 maven 链接等,这不是当前项目的选项)。特别是每个教程都提到,这个库也是作为 OSGi 包提供的。

此外,Spring 框架提供了许多需要作为依赖项安装的包。从 Spring Framework 2.5 版开始,Spring 发行版中包含的 Spring jar 是有效的 OSGi 包,可以直接安装到 OSGi 平台中。

来源: http: //www.eclipse.org/gemini/blueprint/documentation/reference/1.0.2.RELEASE/html/app-deploy.html

但是我能找到的所有下载(例如http://maven.springframework.org/release/org/springframework/spring/3.2.5.RELEASE/)只包含普通的 jar,没有 OSGi 包。自 Spring 3.x 起,提供 OSGi 捆绑包的做法是否已停止?如何将必要的 Spring 依赖项添加到我的项目中?教程/文档是否已过时?

我正在使用最新版本的 Gemini 1.0.2。

4

4 回答 4

2

您可以使用 Eclipse Maven 存储库

<repositories>
<repository>
    <id>gemini-blueprint</id>
    <name>Gemini Blueprint</name>
    <url>https://repo.eclipse.org/content/groups/gemini-blueprint/</url>
</repository>
</repositories>

<dependencies>
<dependency>
    <groupId>org.eclipse.gemini.blueprint</groupId>
    <artifactId>gemini-blueprint-extender</artifactId>
    <version>2.0.0.BUILD-SNAPSHOT</version>
</dependency>
</dependencies>

Blueprint Extender 的传递依赖将包含您需要的所有 Spring 内容。

于 2013-11-29T18:16:53.047 回答
2

如果您需要 OSGi'ified Jars,我建议使用 springsource 企业捆绑存储库,该存储库位于:http ://ebr.springsource.com/

springsource ebr 不仅提供支持 osgi 的 spring-jars,它还提供了许多带有 osgi-Manifest.MF 文件的第三方 osgi 库。

例如,它包含您在帖子中提到的 OSGi 兼容 Jar:http ://ebr.springsource.com/repository/app/bundle/version/detail?name=org.springframework.aop&version=3.2.5.RELEASE&searchType=bundlesBySymbolicName&searchQuery =org.springframework.aop

于 2014-02-25T15:40:17.127 回答
1

我对 Gemini Blueprint 有点怀疑。自从 VMware 接管 SpringSource 以来,他们似乎几乎停止了对 OSGi 的努力。幸运的是, Apache Aries提供了一种替代实现,它得到了 IBM 和其他一些公司的支持。

您还应该看看Apache Karaf。它预先安装了蓝图,并允许轻松添加许多其他框架。我已经完成了一些教程,展示了如何将蓝图与 CXF、Camel、JPA 等多种技术一起使用。

于 2013-11-29T09:00:47.857 回答
0

如果您关心的是 OSGi 框架中的简单依赖注入,我建议您也查看 OSGi 声明式服务,例如 Felix 实现,尤其是与Bndtools结合使用,或者,如果您使用的是 PDE,则可以使用DS 注释处理器,这使得它非常简单通过注解执行依赖注入。总的来说,我发现这些解决方案比 Spring/Gemini/Blueprint 更轻量级且更易于使用。

于 2013-12-01T12:52:21.223 回答