04-25-2017 11:29 AM
Hi,
I have a component that declares a service. The service has different implementations provided in separate bundles:
The service and implementations are declared in a contribution in each bundle, like this:
// BaseBundle
<?xml version="1.0"?>
<component name="BaseBundleComponent">
<implementation class="org.example.service.impl.BaseServiceImpl"/>
<service>
<provide interface="org.example.service.ServiceInterface"/>
</service>
</component>
// SecondBundle
<?xml version="1.0"?>
<component name="SecondBundleComponent">
<require>BaseBundleComponent</require>
<implementation class="org.example.service.impl.SecondServiceImpl"/>
<service>
<provide interface="org.example.service.ServiceInterface"/>
</service>
</component>
// ThirdBundle
<?xml version="1.0"?>
<component name="ThirdBundleComponent">
<require>SecondBundleComponent</require>
<implementation class="org.example.service.impl.ThirdServiceImpl"/>
<service>
<provide interface="org.example.service.ServiceInterface"/>
</service>
</component>
So, the SecondBundle requires the BaseBundle (because it extends BaseBundle implementation). And the ThirdBundle requires the SecondBundle (for the same reason). I thought that with the requires I would be able to override the implementation of ServiceInterface:
But I've seen that it is not that way.
So what is the correct way to override the implementation of a service depending on the bundles that are loaded? Is it possible?
Thank you in advance,
04-26-2017 08:59 AM
As it turns out, I had a typo in the contribution of the third bundle, and that was the reason why it didn't work. So, using different implementations with requires actually works in my case.
Sorry for the mistake!
04-26-2017 08:59 AM
As it turns out, I had a typo in the contribution of the third bundle, and that was the reason why it didn't work. So, using different implementations with requires actually works in my case.
Sorry for the mistake!
04-26-2017 09:01 AM
Ok good to know thanks, that was surprising to me.
04-26-2017 09:08 AM
Thanks! It's good to know.
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.