It turns out my colleague didn't have the Spring @RunWith registered
with his test case.  Once that was in place then the converter worked
simply by adding @Autowired onto the required service component, and the
Injector took care of the rest. No need for ApplicationContextAware or
passing in the Exchange.


----- Original message -----
From: "James Strachan" <james.strac...@gmail.com>
To: users@camel.apache.org
Date: Tue, 31 Mar 2009 11:47:26 +0100
Subject: Re: Type converters with Spring

2009/3/31 Martin Gilday <martin.li...@imap.cc>:
> 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.

Its maybe a sentence that needs refactoring :)

The concept its trying to convey, I think, is that if your converter
requires some state (e.g. a JAXB provider, a database connection or
whatever) you can use dependency injection on the converter object; as
we use the registry to instantiate it...
http://camel.apache.org/registry.html

plus with Claus's point, the converter method can use the Exchange to
get the Injector/Registry explicitly.

-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://fusesource.com/

Reply via email to