camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brad Johnson <>
Subject Re: CamelBlueprintTestSupport No bean could be found in the registry
Date Mon, 08 Feb 2016 01:43:50 GMT
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

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.

    protected void
addServicesOnStartup(Map<String,KeyValueHolder&lt;Object, Dictionary>>
services) {
        services.put( MyServiceInterface.class.getName(), asService(new
StubServiceImplementation(), "implementation", "stub"));

On Fri, Feb 5, 2016 at 4:53 PM, enigma <> wrote:

> Thank you and Have a good weekend! :)
> --
> View this message in context:
> Sent from the Camel - Users mailing list archive at

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message