Versions Compared

Key

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

...

Code Block
languagejava
public static void main(String... args) {
    ApplicationContext applicationContext = new SpringApplication(MyCamelApplication.class).run(args);
    CamelSpringBootApplicationController applicationController =
            applicationContext.getBean(CamelSpringBootApplicationController.class);
    applicationController.blockMainThread();
}

Adding XML routes

By default you can put Camel XML routes in the classpath under the directory camel, which camel-spring-boot will auto detect and include. From Camel 2.17 onwards you can configure the directory name or turn this off using the configuration option

Code Block
// turn off
camel.springboot.xmlRoutes = false
// scan in the com/foo/routes classpath
camel.springboot.xmlRoutes = classpath:com/foo/routes/*.xml

The XML files should be Camel XML routes (not CamelContext) such as

Code Block
xml
xml
<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.xsd
       http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
 
   <routes xmlns="http://camel.apache.org/schema/spring">
        <route id="test">
            <from uri="timer://trigger"/>
            <transform>
                <simple>ref:myBean</simple>
            </transform>
            <to uri="log:out"/>
        </route>
    </routes>
</beans>

 


Include Page
Endpoint See Also
Endpoint See Also