Deploy as a plain Spring XML file

ServiceMix 4.5.0 supports the deployment of plain Spring XML files, automatically creating and starting the Spring ApplicationContext from the XML file.

In order to leverage this feature to create and start Camel routes, drop a file with this syntax in the $SERVICEMIX_HOME/deploy folder:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:camel="http://camel.apache.org/schema/spring"
       xsi:schemaLocation="
          http://www.springframework.org/schema/beans
            http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
          http://camel.apache.org/schema/spring
            http://camel.apache.org/schema/spring/camel-spring-2.10.3.xsd">

  <camelContext xmlns="http://camel.apache.org/schema/spring">
    <!-- add Camel routes, interceptors,... here --> 
  </camelContext>

</beans>

An example

Just create a new XML file in the deploy folder with the code below to start a route to copy files from one directory to another.

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:camel="http://camel.apache.org/schema/spring"
       xsi:schemaLocation="
          http://www.springframework.org/schema/beans
            http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
          http://camel.apache.org/schema/spring
            http://camel.apache.org/schema/spring/camel-spring-2.10.3.xsd">

  <camelContext xmlns="http://camel.apache.org/schema/spring">
    <route>
      <from uri="file:input"/>
      <log message="Copying ${file:name} to the output directory"/>
      <to uri="file:output"/>
    </route>
  </camelContext>

</beans>