【问题标题】:Create Spring context in OSGI through the API通过 API 在 OSGI 中创建 Spring 上下文
【发布时间】:2014-11-04 09:58:00
【问题描述】:

进一步澄清我的问题:

我有一个带有骆驼路线的 spring xml 文件。我想在 BundleActivator 中引导这条路线。 OSGI 世界中初始化和启动 SpringContext 以及向 OSGI 注册中心注册的步骤是什么。我想通过 api 来做这个自定义——需要控制它而不是使用 spring DM。我知道我需要使用 OSGI 类。任何示例:

这不会启动路线:

ConfigurableApplicationContext  ctx = new GenericApplicationContext();
ConfigurableEnvironment environment = ctx.getEnvironment();
//set up the props for the context
XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader((BeanDefinitionRegistry) ctx);
ClassPathResource classPathResource = new ClassPathResource("context.xml",properClassLoader );
xmlReader.loadBeanDefinitions(classPathResource);
ctx.refresh();
ctx.start();

谢谢。

【问题讨论】:

    标签: spring osgi osgi-bundle spring-dm


    【解决方案1】:

    您正在寻找的是所谓的托管服务工厂。 查看eclipse gemini 项目的描述。

    【讨论】:

      猜你喜欢
      • 2011-04-16
      • 1970-01-01
      • 2011-05-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-06-02
      • 1970-01-01
      相关资源
      最近更新 更多