Hi,
I'm a little confused as to how services are wired together with OSGi and Spring DM. Let's say I have a bundle called GoodMovieLister and another called OldMovieLister. Both of these depend on a service to find movies defined by a MovieLocator interface. If there are two services OldMovieLocator and GoodMovieLocator, as far as I understand, we cannot rely on OSGi to find the right service for the right bundle as they both implement the same interface. This means, we need to reference the implementing class of each service directly:
In OldMovieLister config:
<reference id="movieLocator" interface="com.xyz.OldMovieLocator"/>
In GoodMovieLister config:
<reference id="movieLocator" interface="com.xyz.GoodMovieLocator"/>
The problem with this comes if I define a new service called AwesomeMovieLocator. I want the GoodMovieLister to use this new locator as obviously, awesome movies are better than good ones. However, I cannot introduce this new service without modifying the configuration of all the services that are dependent on it:
In GoodMovieLister config:
<reference id="movieLocator" interface="com.xyz.AwesomeMovieLocator"/>
Is there a way to dynamically change the service used by the GoodMovieLister to the new AwesomeMovieLocator without modifying its configuration, or the configuration of any other movie listers?


