1 Reply Latest reply on Feb 27, 2015 2:54 PM by slayercode2

    Spring CDI (beans.xml) in switchyard project

    slayercode2

      Hello,

       

      I am currently working on a project using the fuse service works (switchyard, ....). I have created a Spring XML configuration file (src/main/resources/META-INF/beansCDI.xml) which contains the CDI beans (beans, camelContext, ...) that i want to inject. The issue that I cannot retrieve the beans defined in beansCDI.xml to inject them in my camel route (route.xml). Also, I have tried to use ApplicationContext to load beansCDI.xml but without success. Note that using annotations (@Produces @Named) to inject beans works perfectly. But, in my case i want to use the spring DSL.

       

      Here my beansCDI.xml [example taken from the "Camel in Action" book]:

      <beans xmlns="http://www.springframework.org/schema/beans"

          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

          xsi:schemaLocation=" http://www.springframework.org/schema/beans

                                           http://www.springframework.org/schema/beans/spring-beans-3.0.xsd

                                           http://camel.apache.org/schema/spring

                                           http://camel.apache.org/schema/spring/camel-spring.xsd">

       

          <bean id="jms" class="org.apache.camel.component.jms.JmsComponent">

              <property name="connectionFactory">

                  <bean class="org.apache.activemq.ActiveMQConnectionFactory">

                      <property name="brokerURL" value="vm://localhost" />

                  </bean>

              </property>

          </bean>

       

          <bean id="ftpToJmsRoute" class="camelinaction.FtpToJMSRoute" />

       

          <camelContext xmlns="http://camel.apache.org/schema/spring">

              <routeBuilder ref="ftpToJmsRoute" />

          </camelContext>

      </beans>

       

      Any suggestions would be grateful.

      Thank you.