为了进一步澄清我的问题:
我有一个包含camel路由的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();谢谢。
发布于 2014-09-11 21:41:34
您正在寻找的是托管服务工厂。请看一下eclipse gemini项目的描述。
https://stackoverflow.com/questions/25770720
复制相似问题