请帮我解决一个问题。我有一个osgi包。蓝图配置如下所示
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
<bean class="test.SomeBean">
<argument>
<reference-list availability="mandatory" member-type="service-object" interface="test.Service1"/>
</argument>
</bean>
<service interface="test.Service1">
<bean class="test.Service1Impl">
<argument>
<reference-list availability="mandatory" member-type="service-object" interface="test.Service2"/>
</argument>
</bean>
</service>
<service interface="test.Service2">
<bean class="test.Service2Impl"/>
</service>
</blueprint>部署之后,我得到一个java.util.concurrent.TimeoutException。如果我将Service2声明移到另一个包中,或者将可用性更改为可选,那么所有操作都很好。为什么?
发布于 2015-08-20 21:13:04
原因是你依赖于你所提供的服务。对于强制服务,BLueprint不能这样做。
原因是,每当蓝图命中强制引用时,它都确保在开始之前解决依赖关系。只有当所有强制引用都被解析时,上下文的服务才会被发布。
https://stackoverflow.com/questions/32125241
复制相似问题