On 07/03/2008, xjn <[EMAIL PROTECTED]> wrote:
>
>  Hi,
>
>  i would like to dependency inject a CamelTemplate via Spring using the
>  <camel:camelTemplate> tag and WITHOUT using an @EndpointInject annotation.
>
>  I tried to use
>
>  <camel:camelTemplate id="myCamelTemplate"
>  defaultEndpoint="direct:myEndpoint" />
>
>  <bean id=".." class="..">
>   <property name="camelTemplate" ref="myCamelTemplate"
>  </bean>
>
>  but this is not possible and I can't find out how to do this.

Yeah - my bad. It looks like the generated XSD doesn't support this yet.

As a workaround you can just create the bean for the CamelTemplate
directly and inject it...

<bean id=".." class="..">
 <property name="camelTemplate"> <bean class="org.apache.camel.
CamelTemplate"/> </property>
</bean>


I've just added a test case to trunk and fixed this; if you're
interested take a look at DependencyInjectCamelTemplateTest

So you can now do things like...

  <camelContext xmlns="http://activemq.apache.org/camel/schema/spring";>
    <template id="myTemplate" defaultEndpoint="mock:results"/>
  </camelContext>

  <bean id="myBean" class="org.apache.camel.spring.config.TemplateUsingBean">
    <property name="template" ref="myTemplate"/>
  </bean>


>  And i can't find, what the <camel:camelTemplate> tag is for.
>
>  And what do i have to do, if i have more than one Camel context in a Spring
>  context ?
>
>  Btw:
>  I know i can use <bean id="myCamelTemplate"
>  class="...CamelTemplate"><constructor-arg...</>

BTW CamelTemplateFactoryBean implements CamelContextAware so it gets
the camel context injected.

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

Open Source Integration
http://open.iona.com

Reply via email to