首页 文章

Spring框架下载为OSGi捆绑包

提问于
浏览
2

我正在使用Spring for OSGi,即Eclipse Gemini Blueprint .

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

此外,Spring Framework提供了许多需要作为依赖项安装的软件包 . 从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-bundle的做法是否已停止?如何将必要的Spring依赖项添加到我的项目中?教程/文档是否已过时?

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

4 回答

  • 2

    您可以使用Eclipse Maven Repository

    <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内容 .

  • 2

    如果您需要OSGi'ified Jars,我建议使用Springsource企业捆绑存储库,可以在以下位置找到:http://ebr.springsource.com/

    Springsource ebr不仅提供支持osgi的spring-jar,它还提供了许多带有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

  • 0

    我对双子座蓝图有点怀疑 . 由于VMware接管了SpringSource,他们似乎已经几乎停止了对OSGi的努力 . 幸运的是,Apache Aries还有一个替代实现,它由IBM和其他一些公司提供支持 .

    您还应该看一下Apache Karaf . 它附带预先安装的蓝图,可以轻松添加许多其他框架 . 我已经做了一些教程,展示了如何使用CXF,Camel,JPA等多种技术的蓝图 .

  • 1

    如果您关注的是OSGi框架中的简单依赖注入,我建议还要查看OSGi声明性服务,如Felix实现,特别是与Bndtools结合使用,或者,如果您使用的是PDE,那么DS annotations processor会使执行依赖性变得非常简单通过注释注射 . 总的来说,我发现这些解决方案比Spring / Gemini / Blueprint更轻巧,更简单 .

相关问题