You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Colm O hEigeartaigh <co...@apache.org> on 2014/12/05 19:17:03 UTC

spring.Main bind?

Hi all,

Fairly basic question here. According to the following link, the Main class
has a "bind" method to add classes to the registry:

http://camel.apache.org/running-camel-standalone-and-have-it-keep-running.html

// bind MyBean into the registery
main.bind("foo", new MyBean());

However this isn't available for spring.Main. How can I add classes to the
registry using spring.Main? I'm aware I can do it in the spring file...just
wondering if there is an easy way to do it via code.

Colm.


-- 
Colm O hEigeartaigh

Talend Community Coder
http://coders.talend.com

Re: spring.Main bind?

Posted by Minh Tran <da...@gmail.com>.
Just declare the bean via java code. Refer to the spring docs for @Configuration. Though if you already have the spring xml, it’s easier to just simply add it there.

On 6 Dec 2014, at 5:17 am, Colm O hEigeartaigh <co...@apache.org> wrote:

> Hi all,
> 
> Fairly basic question here. According to the following link, the Main class
> has a "bind" method to add classes to the registry:
> 
> http://camel.apache.org/running-camel-standalone-and-have-it-keep-running.html
> 
> // bind MyBean into the registery
> main.bind("foo", new MyBean());
> 
> However this isn't available for spring.Main. How can I add classes to the
> registry using spring.Main? I'm aware I can do it in the spring file...just
> wondering if there is an easy way to do it via code.
> 
> Colm.
> 
> 
> -- 
> Colm O hEigeartaigh
> 
> Talend Community Coder
> http://coders.talend.com


Re: spring.Main bind?

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

When using Camel with Spring it uses the spring app context as
registry, so you need to use that, eg the spring way.
I guess you can grab somehow the spring app context, and use its api
to bind. And if that is possible, maybe we can add a bind operation to
the spring main as a facade for that.

The bind method is for standalone mode, where Camel uses its own
registry, eg a plain map aka SimpleRegistry.



On Fri, Dec 5, 2014 at 7:17 PM, Colm O hEigeartaigh <co...@apache.org> wrote:
> Hi all,
>
> Fairly basic question here. According to the following link, the Main class
> has a "bind" method to add classes to the registry:
>
> http://camel.apache.org/running-camel-standalone-and-have-it-keep-running.html
>
> // bind MyBean into the registery
> main.bind("foo", new MyBean());
>
> However this isn't available for spring.Main. How can I add classes to the
> registry using spring.Main? I'm aware I can do it in the spring file...just
> wondering if there is an easy way to do it via code.
>
> Colm.
>
>
> --
> Colm O hEigeartaigh
>
> Talend Community Coder
> http://coders.talend.com



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/