Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

You can use Java Code to define your RouteBuilder implementations, then in your spring.xml you can specify the Java package names to search for (recursively) to find your routes such as in the following example.

Wiki Markup
{snippet:id=example|lang=xml|url=activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/camelContextFactoryBeanTestcamelContextFactoryBean.xml}

Or if you prefer you can use the Spring 2.0 XML Namespaces approach

Wiki Markup
{snippet:id=example3|lang=xml|url=activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/camelContextFactoryBeanTestcamelContextFactoryBean.xml}

Using Spring XML

You can use Spring 2.0 XML configuration to specify your Xml Configuration for Routes such as in the following example.

Wiki Markup
{snippet:id=example|lang=xml|url=activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/routingUsingCamelContextFactoryTestroutingUsingCamelContextFactory.xml}

Configuring Components and Endpoints

You can configure your Component or Endpoint instances in your Spring XML as follows in this example.

Wiki Markup
{snippet:id=example|lang=xml|url=activemq/camel/trunk/components/camel-jms/src/test/resources/org/apache/camel/component/jms/jmsRouteUsingSpringTestjmsRouteUsingSpring.xml}

Wiki Markup
Which allows you to configure a component using some name (activemq in the above example), then you can refer to the component using *activemq:\[queue:\|topic:\]destinationName*. This works by the SpringCamelContext lazily fetching components from the spring context for the scheme name you use for [Endpoint] [URIs].

...