According to my humble opinion, the asService() method should ideally have Interface instead of Implementation argument.
The asService is there to create a proxy to the actual implementation class I believe. What you are actually putting in the registry is a key of the value of the full package and class name of the interface. That's what blueprint is going to look up the service based upon. The value is what you put in as the implementation. In a true blueprint environment that implementation will be hidden behind a proxy object that exposes the interface. Any bundle wanting to use that proxied implementation then just tells it what the package anc class name of the interface are. In other words, when that interface is fetched from the OSGi registry and handed to the requester, the requester doesn't know what concrete implementation it is talking to. It may be a test stub, it may be the actual implementation. In fact, if you try to then cast that to the concrete implementation of the class it will fail because what it finds is a proxy of the interface. This also makes it possible to hot swap bundles at run time because the proxy stays the same but the implementation changes. I'm still mystified why your test class wasn't picking up the service from your first bundle though. If you have have it exported and referenced and listed as a test dependency in your client bundle then it should be automatically loaded up. One of those pieces sounds as if it is missing. @Override protected void addServicesOnStartup(Map<String,KeyValueHolder<Object, Dictionary>> services) { services.put( MyServiceInterface.class.getName(), asService(new StubServiceImplementation(), "implementation", "stub")); } On Fri, Feb 5, 2016 at 4:53 PM, enigma <send2she...@gmail.com> wrote: > Thank you and Have a good weekend! :) > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/CamelBlueprintTestSupport-No-bean-could-be-found-in-the-registry-tp5777228p5777317.html > Sent from the Camel - Users mailing list archive at Nabble.com. >