首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >通过API在OSGI中创建Spring上下文

通过API在OSGI中创建Spring上下文
EN

Stack Overflow用户
提问于 2014-09-11 00:36:20
回答 1查看 74关注 0票数 0

为了进一步澄清我的问题:

我有一个包含camel路由的spring xml文件。我想在BundleActivator中引导此路由。在OSGI世界中,初始化和启动SpringContext并向OSGI注册中心注册有哪些步骤。我想通过api来做这个自定义--需要控制它,而不是使用spring DM。我理解我需要使用OSGI类。任何要遵循的示例:

这不会启动路由:

代码语言:javascript
复制
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();

谢谢。

EN

回答 1

Stack Overflow用户

发布于 2014-09-11 21:41:34

您正在寻找的是托管服务工厂。请看一下eclipse gemini项目的描述。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/25770720

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档