title: How to? - Apache Camel with Spring Boot and XML configuration
body: <p>I have an application in which I am using Spring boot MVC and camel.
  below is the code that I am running.</p>
  
  <pre><code>@ComponentScan({"com.xyz.routes","com.xyz.web","com.xyz.security"})
  @SpringBootApplication
  //@ImportResource("classpath:META-INF/spring/camelContext.xml")
  public class Application {
  
      public static void main(String[] args) { 
          ApplicationContext applicationContext  = SpringApplication.run(Application.class, args);
      }
  </code></pre>
  
  <p>If I use @ImportResource annotation above (currently commented) the camel routes don't start.</p>
  
  <p>For example below is without annotation.</p>
  
  <pre><code>INFO | 27 Apr 2018 15:26:31,149 | [main] org.apache.camel.spring.SpringCamelContext - Total 1 routes, of which 1 are started. |  |  | (DefaultCamelContext.java:2834)
  INFO | 27 Apr 2018 15:26:31,150 | [main] org.apache.camel.spring.SpringCamelContext - Apache Camel 2.17.0 (CamelContext: camel-1) started in 0.255 seconds |  |  | (DefaultCamelContext.java:2835)
  </code></pre>
  
  <p>And below two log lines are after I enabled annotation.</p>
  
  <pre><code>INFO | 27 Apr 2018 15:30:56,755 | [main] org.apache.camel.spring.SpringCamelContext - Total 0 routes, of which 0 are started. |  |  | (DefaultCamelContext.java:2834)
  INFO | 27 Apr 2018 15:30:56,755 | [main] org.apache.camel.spring.SpringCamelContext - Apache Camel 2.17.0 (CamelContext: mtmSender) started in 0.089 seconds |  |  | (DefaultCamelContext.java:2835)
  </code></pre>
  
  <p>Any idea why this is not working when I enable the annotation? Note - Total routes are zero.</p>
  
  <p>Please note that I need XML config because I am planning to define beans and properties there later.</p>
  
  <p>Below is the camelContext.xml</p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;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"
      xmlns:context="http://www.springframework.org/schema/context"
      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
           "&gt;
  
      &lt;bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" &gt;
          &lt;property name="locations"&gt;
              &lt;list&gt;
                  &lt;value&gt;${application-default.properties}&lt;/value&gt;
                  &lt;value&gt;${application.properties}&lt;/value&gt;
              &lt;/list&gt;
          &lt;/property&gt;
          &lt;property name="ignoreUnresolvablePlaceholders" value="true"/&gt;
          &lt;property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_NEVER" /&gt;
      &lt;/bean&gt;
      &lt;bean id="sampleBean" class="com.xyz.model.SampleBean" /&gt;
  
      &lt;camelContext xmlns="http://camel.apache.org/schema/spring"  id="mtmSender"&gt;
          &lt;properties&gt;
              &lt;property key="CamelLogDebugStreams" value="true"/&gt;
          &lt;/properties&gt;
      &lt;/camelContext&gt;
  
  &lt;/beans&gt;
  </code></pre>