【发布时间】:2017-08-05 02:30:16
【问题描述】:
我们正在使用 Blueprint + Camel + Karaf ,从 Spring 迁移。 我是 OSgi Blueprint 的新手。我们正在使用 Blueprint XML 从 blueprint xml 中定义的 bean 定义服务。
在 Blueprint XML 中添加 Service 后,至少从 karaf 获取如下: 仅供参考:捆绑处于活动状态
karaf>service:list | grep custom
[org.apache.camel.Processor, com.rnd.model.impl.PaymentServiceProcessorBase,com.rnd.generic.CustomServiceP rocessor]osgi.service.blueprint.compname = customPaymentProcessor
我确定 bean 正在注册到 OSGI 服务。但不知何故,它对其他 Bundle 中的其他 XML 不可见。
**Blueprint XML**::
<bean id="customPaymentProcessor" class="blah blah"/>
<service ref="customPaymentProcessor" auto-export="all-classes"/>
请帮助我如何在 APPConfig(在 karaf 根目录下)文件夹中的 Routes XML 文件中访问此 bean。
myRoutes.xml
<!-- Add this route to CamelContext Using LoadRouteDefinitions -->
<routes id="xyz-Context" xmlns="http://camel.apache.org/schema/spring">
<route id="xyz-one">
<from uri="direct:xyz"/>
<!-- this customPayProcesssor is exposed as above -->
<process ref="customPayProcesssor"/>
</route>
</routes>
所有的 Osgi 服务都隐式注册为 oSGI regsitry 供骆驼搜索。但我得到了;::
[Bean[ref:cust... because of No bean could be found in the registry for: customPaymentProcessor
【问题讨论】:
标签: java apache-camel osgi-bundle blueprint-osgi