我有一个 spring 上下文,它导出这样定义的 osgi/META-INF/spring/spring-dao.xml
服务
<osgi:service ref="stockDao" interface="com.test.StockDao" />`
问题是:我想在我的蓝图中使用上面定义的服务,它在 location 下定义/OSGI-INF/blueprint/blueprint.xml
。
<reference id="stockDao" interface="com.test.StockDao" />`
进行此配置后,我收到以下错误
java.lang.Exception: Can not resolve feature:
Unsatisfied requirement(s):
---------------------------
service:(service=com.test.StockDao)
Boohoo Database Test
at org.fusesource.fabric.agent.ObrResolver.resolve(ObrResolver.java:215)[67:org.fusesource.fabric.fabric-agent:7.2.0.redhat-024]
at org.fusesource.fabric.agent.DeploymentAgent.updateDeployment(DeploymentAgent.java:566)[67:org.fusesource.fabric.fabric-agent:7.2.0.redhat-024]
at org.fusesource.fabric.agent.DeploymentAgent.doUpdate(DeploymentAgent.java:432)[67:org.fusesource.fabric.fabric-agent:7.2.0.redhat-024]
at org.fusesource.fabric.agent.DeploymentAgent$1.run(DeploymentAgent.java:242)[67:org.fusesource.fabric.fabric-agent:7.2.0.redhat-024]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)[:1.6.0_43]
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)[:1.6.0_43]
at java.util.concurrent.FutureTask.run(FutureTask.java:138)[:1.6.0_43]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)[:1.6.0_43]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)[:1.6.0_43]
at java.lang.Thread.run(Thread.java:662)[:1.6.0_43]
目前,spring bean中导出的osgi服务只能被spring bean引用。另一方面,蓝图导出的服务只能被另一个蓝图引用。
如果我弄错了,请纠正我?如果这是可能的,我该怎么做。