You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by helander <le...@gmail.com> on 2013/03/12 10:26:43 UTC

Register beans

Fom Java code I would like to register beans in the context registry. I need
to do this in code that will deployed in various containers (Spring, JEE web
applications). 
Is there some method that works in all these environments (hiding from my
code the current registry implementation) or do I have to explicitly test
the registry class in order to invoke class specific registration methods ?

Thanks

Lars



--
View this message in context: http://camel.465427.n5.nabble.com/Register-beans-tp5728978.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Register beans

Posted by Lars-Erik Helander <le...@gmail.com>.
Ok, thanks for the clarifcation and the hint about the composite registry.

Lars

Skickat från min iPhone

12 mar 2013 kl. 13:12 skrev Claus Ibsen <cl...@gmail.com>:

> On Tue, Mar 12, 2013 at 10:26 AM, helander <le...@gmail.com> wrote:
>> Fom Java code I would like to register beans in the context registry. I need
>> to do this in code that will deployed in various containers (Spring, JEE web
>> applications).
>> Is there some method that works in all these environments (hiding from my
>> code the current registry implementation) or do I have to explicitly test
>> the registry class in order to invoke class specific registration methods ?
>> 
>> Thanks
>> 
>> Lars
> 
> No as the actual registry can be anything, and some is read-only.
> So you would need to cater for that, and eg if its a spring registry
> (spring app context) then its read-only.
> 
> But if you use Jndi registry, then you can often use the bind
> operation to add new beans to it etc.
> If you are allowed to do so (as it may be secured).
> 
> Though if you need a local registry that only Camel needs to be able
> to use, you can wrap the current registry using the composite registry
> and add a simple registry as well.
> 
> And then you can use the SimpleRegistry to add/remove your beans from
> your Java code.
> 
> 
> 
>> 
>> 
>> --
>> View this message in context: http://camel.465427.n5.nabble.com/Register-beans-tp5728978.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
> 
> 
> 
> -- 
> Claus Ibsen
> -----------------
> Red Hat, Inc.
> FuseSource is now part of Red Hat
> Email: cibsen@redhat.com
> Web: http://fusesource.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen

Re: Register beans

Posted by Claus Ibsen <cl...@gmail.com>.
On Tue, Mar 12, 2013 at 10:26 AM, helander <le...@gmail.com> wrote:
> Fom Java code I would like to register beans in the context registry. I need
> to do this in code that will deployed in various containers (Spring, JEE web
> applications).
> Is there some method that works in all these environments (hiding from my
> code the current registry implementation) or do I have to explicitly test
> the registry class in order to invoke class specific registration methods ?
>
> Thanks
>
> Lars
>

No as the actual registry can be anything, and some is read-only.
So you would need to cater for that, and eg if its a spring registry
(spring app context) then its read-only.

But if you use Jndi registry, then you can often use the bind
operation to add new beans to it etc.
If you are allowed to do so (as it may be secured).

Though if you need a local registry that only Camel needs to be able
to use, you can wrap the current registry using the composite registry
and add a simple registry as well.

And then you can use the SimpleRegistry to add/remove your beans from
your Java code.



>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Register-beans-tp5728978.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen