camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Strachan <>
Subject Re: Scala and Spring config
Date Fri, 22 May 2009 09:53:35 GMT
2009/5/22 EwanH <>:
> How does one get a reference to the camelcontext

If your bean implements CamelContextAware it will be injected into you

> when using a spring
> ContextLoaderListener set in web.xml that configures a RouteBuilder using
> package scanning?  Below I have context that on start seems to boot up fine:
>  <camelContext xmlns="">
>    <package>myapp.routes</package>
>  </camelContext>
> However I now want to create a ProducerTemplate from the context which I was
> hoping would be via a factory method but can't find one.  Any ideas?

You should be able to just have one automatically injected into your
class for you by using the @Produces annotation...

or just create a producer template using the <template> element

 <camelContext xmlns="">
    <template id="myTemplate"/>

then look it up in Spring by id.

My preferred approach is to have spring inject whatever it is you want
(e.g. the ProducerTemplate) using the @Produces annotation.


Open Source Integration

View raw message