Thanks, we will give those a try.

As your suggestions seem to differ from what I quoted I am still
interested in what the docs are referring to here
http://camel.apache.org/type-converter.html  Any ideas what it means by
plugging in an Injector?  I'll try and update the wiki if this section
is incorrect.


----- Original message -----
From: "Claus Ibsen" <claus.ib...@gmail.com>
To: users@camel.apache.org
Date: Tue, 31 Mar 2009 12:04:27 +0200
Subject: Re: Type converters with Spring

Hi

Or pass in Exchange as the 2nd parameter.
Using Exchange you can get hold on the CamelContext and thus the
registry as well, and do lookup for Spring beans.



On Tue, Mar 31, 2009 at 12:01 PM, James Strachan
<james.strac...@gmail.com> wrote:
> 2009/3/31 Martin Gilday <martin.li...@imap.cc>:
>> I'd like to have a converter which uses a Spring @service to do lookups.
>>  According to the docs "If a converter requires configuration you can
>> plug in an Injector interface to the DefaultTypeConverter which can
>> construct and inject converter objects via Spring or Guice."
>>
>> I'm unsure what it means by working with the DefaultTypeConverter. Are
>> there any examples which show how to do this?
>
> You could try something like this
>
> public class MyServiceConverter implements ApplicationContextAware {
>  ApplicationContext context;
>
> �...@converter
>  public MyType convert(String name) {
>   return context.getbean(name, MyType.class);
>  }
> }
>
> letting spring do whatever dependency injection you require on the
> converter object
>
> --
> James
> -------
> http://macstrac.blogspot.com/
>
> Open Source Integration
> http://fusesource.com/
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus
Apache Camel Reference Card:
http://refcardz.dzone.com/refcardz/enterprise-integration

Reply via email to