【问题标题】:Where can I find Spring 4 OSGi bundles我在哪里可以找到 Spring 4 OSGi 包
【发布时间】:2014-02-06 12:04:53
【问题描述】:

在哪里可以找到 Spring 4 的 OSGi 包?我检查了http://ebr.springsource.com/,但只能找到 Spring 3.2.x 并且 Maven Central 中的工件不是捆绑包。

澄清

我不是在寻找 Spring DM 或类似的东西。我正在寻找作为 OSGi 包的“Spring 框架”JAR(spring-core、spring-beans、spring-context,...)。我不想在 OSGi 环境中创建应用程序上下文。我只需要 OSGi 环境中的(异常)类。

【问题讨论】:

标签: spring osgi


【解决方案1】:

Spring 源去年停止使用 OSGI 标头创建 jar: http://www.infoq.com/news/2012/10/spring-osgi-gradle/

我认为您不会获得包含 Spring 的 OSGI 捆绑包的官方 maven 存储库。我们经常将http://ebr.springsource.com/ 用于 OSGI 捆绑包,但即便如此,它也不包含 3.2 之后的任何版本

由于回购量少,无法添加为评论,因此添加为答案。

【讨论】:

  • 无论捆绑包最终是否会出现在 EBR 中,官方的东西都会很好。
【解决方案2】:

【讨论】:

  • 这些都不是我要找的库。我不是在寻找 Spring-OSGi,它包含的最新版本似乎是 3.1.4。
【解决方案3】:

Spring 将支持任何进一步的版本作为 OSGi 捆绑包。 Spring 3.2.4 已停止官方支持(尽管您可以找到 3.2.5 工件here,与Eclipse Forum 中的声明相矛盾)

来自 Spring 来源的 Glyn Normington 承认,在多个地方,请参见此处:

不过,还是有希望的。在 Karaf - dev 列表中,可以看到他们打算在 ServiceMix 项目中支持 spring 库。整个线程中的详细信息见here

【讨论】:

    【解决方案4】:

    我必须说,将 Spring 迁移到 OSGi 仍然存在于 Apache ServiceMix 中。 从 maven repo 获取最新的 (4.0.2.RELEASE) Spring 工件以及启用 OSGi 的清单

    【讨论】:

    • 这不再是真的。随着 Apache Servicemix 5.1.1 的发布,Spring 4.0.2.RELEASE osgi 包不再可用。
    • 更新:Spring 4.0.5 版本再次回归 Servicemix 5.3.0
    【解决方案5】:

    我发现 ServiceMix 提供了最高版本的 OSGi-fy Spring 包。 4.1.4, http://repo2.maven.org/maven2/org/apache/servicemix/bundles/org.apache.servicemix.bundles.spring-aop/

    我在我的 osgi Bundle 项目中尝试过,像这样设置依赖:

     <dependency>
            <groupId>org.apache.servicemix.bundles</groupId>
            <artifactId>org.apache.servicemix.bundles.spring-core</artifactId>
            <version>4.1.1.RELEASE_3</version>
     </dependency>
    

    在 Felix 中运行,发现 sprint 包已激活:

    START LEVEL 1
     ID|State      |Level|Name
    ...
    5|Resolved   |    1|Apache ServiceMix :: Bundles :: spring-expression (4.1.1.RELEASE_3)
    6|Active     |    1|Apache Felix Gogo Command (0.14.0)
    7|Active     |    1|Apache Felix Gogo Runtime (0.12.1)
    8|Active     |    1|Apache Felix Gogo Shell (0.10.0)
    ...
    10|Active     |    1|Apache ServiceMix :: Bundles :: spring-context (4.1.1.RELEASE_3)
    11|Active     |    1|Apache ServiceMix :: Bundles :: spring-core (4.1.1.RELEASE_3)
    .... 
    

    但在最新版本 5.4.0 中,ServiceMix 仅包含 spring 3.2.11。

    在我的 OSGi 环境中使用 spring 4.1.1 有什么风险吗?

    【讨论】:

    • 我发现了一个关于在 OSGi 环境中使用 Spring 的问题。Spring 无法加载嵌入在 spring bundle 中的架构 'springframework.org/schema/beans/spring-beans-4.0.xsd' 资源。在没有 Internet 连接的情况下创建 ClassPathXmlApplicationContext 时会发生 XmlBeanDefinitionStoreException。有没有怎么解决这个问题?
    猜你喜欢
    • 2014-09-20
    • 2011-11-04
    • 1970-01-01
    • 2021-05-29
    • 1970-01-01
    • 2010-12-13
    • 2014-07-16
    • 2012-05-30
    • 2013-07-13
    相关资源
    最近更新 更多