title: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'cxf' is defined - springboot JAVA annotation
body: <p>I was testing  Springboot + camel JAVADSL +cxf webservice . When the spring boot application starts I am getting below mentioned exception and the application context is not getting loaded. Springboot will be loading the camel context so there no camel-context.xml . Camel router are defined in JAVADSL </p>
  
  <pre><code>Sep 03, 2015 5:49:01 PM org.apache.catalina.core.StandardContext loadOnStartup
  SEVERE: Servlet [CXFServlet] in web application [] threw load() exception
  org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'cxf' is defined
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:687)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1168)
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:281)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
      at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:962)
      at org.apache.cxf.transport.servlet.CXFServlet.loadBus(CXFServlet.java:80)
      at org.apache.cxf.transport.servlet.CXFNonSpringServlet.init(CXFNonSpringServlet.java:76)
      at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1231)
      at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1034)
      at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4914)
      at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedContext.deferredLoadOnStartup(TomcatEmbeddedContext.java:66)
      at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.startConnector(TomcatEmbeddedServletContainer.java:209)
      at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.start(TomcatEmbeddedServletContainer.java:152)
      at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.startEmbeddedServletContainer(EmbeddedWebApplicationContext.java:288)
      at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:141)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:483)
      at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
      at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:686)
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:320)
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:957)
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:946)
  </code></pre>
  
  <p>Application Context class</p>
  
  <pre><code>@Configuration
  @ComponentScan
  @EnableAutoConfiguration
  @EnableConfigurationProperties 
  public class Application extends SpringBootServletInitializer {
  
      private static final String CXF_URL_MAPPING = "/cxf/*";
      private static final String CXF_SERVLET_NAME = "CXFServlet";
  
  
      @Override
      protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
          return application.sources(Application.class);
  
      }
  
  @Bean
      public ServletRegistrationBean servletRegistrationBean() {
          ServletRegistrationBean registration =
                  new ServletRegistrationBean(new CXFServlet(), CXF_URL_MAPPING);
          registration.setName(CXF_SERVLET_NAME);
          registration.setLoadOnStartup(1);
          return registration;
      }
  
  
      @Bean
      public EmbeddedServletContainerCustomizer containerCustomizer() {
          return new EmbeddedServletContainerCustomizer() {
              @Override
              public void customize(ConfigurableEmbeddedServletContainer container) {
  
              }
          };
      }
  }
  </code></pre>
  
  <p>POM.XML</p>
  
  <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;artifactId&gt;com&lt;/artifactId&gt;
      &lt;packaging&gt;jar&lt;/packaging&gt;
      &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
  
  
      &lt;parent&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
          &lt;version&gt;1.2.5.RELEASE&lt;/version&gt;
          &lt;relativePath /&gt; &lt;!-- lookup parent from repository --&gt;
      &lt;/parent&gt;
  
      &lt;properties&gt;
          &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
          &lt;java.version&gt;1.8&lt;/java.version&gt;
          &lt;camel.version&gt;2.15.2&lt;/camel.version&gt;
          &lt;junit.version&gt;4.11&lt;/junit.version&gt;
          &lt;log4j.version&gt;1.2.17&lt;/log4j.version&gt;
          &lt;servlet-api.version&gt;3.1.0&lt;/servlet-api.version&gt;
          &lt;hibernate.version&gt;4.3.10.Final&lt;/hibernate.version&gt;
  
      &lt;/properties&gt;
  
      &lt;dependencies&gt;
  
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-actuator&lt;/artifactId&gt;
              &lt;exclusions&gt;
                  &lt;exclusion&gt;
                      &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                      &lt;artifactId&gt;spring-boot-starter-logging&lt;/artifactId&gt;
                  &lt;/exclusion&gt;
              &lt;/exclusions&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-tomcat&lt;/artifactId&gt;
              &lt;scope&gt;provided&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
          &lt;/dependency&gt;
  
  
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-data-jpa&lt;/artifactId&gt;
  
          &lt;/dependency&gt;
  
  
          &lt;!-- &lt;dependency&gt; &lt;groupId&gt;org.apache.cxf&lt;/groupId&gt; &lt;artifactId&gt;cxf-rt-transports-http&lt;/artifactId&gt; 
              &lt;version&gt;2.7.0&lt;/version&gt; &lt;/dependency&gt; --&gt;
  
  
  
  
          &lt;!-- Apache Came CXF Dependencies --&gt;
  
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.cxf&lt;/groupId&gt;
              &lt;artifactId&gt;cxf-rt-frontend-jaxws&lt;/artifactId&gt;
              &lt;version&gt;3.1.2&lt;/version&gt;
          &lt;/dependency&gt;
  
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.cxf&lt;/groupId&gt;
              &lt;artifactId&gt;cxf-rt-transports-http&lt;/artifactId&gt;
              &lt;version&gt;3.1.2&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.cxf&lt;/groupId&gt;
              &lt;artifactId&gt;cxf-rt-rs-extension-search&lt;/artifactId&gt;
              &lt;version&gt;2.6.0&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.cxf&lt;/groupId&gt;
              &lt;artifactId&gt;cxf-rt-rs-extension-providers&lt;/artifactId&gt;
              &lt;version&gt;3.1.2&lt;/version&gt;
          &lt;/dependency&gt;
  
  
  
          &lt;!-- End of Apache Came CXF Dependencies --&gt;
  
          &lt;!-- Apache Common --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;commons-lang&lt;/groupId&gt;
              &lt;artifactId&gt;commons-lang&lt;/artifactId&gt;
              &lt;version&gt;2.6&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;!-- camel --&gt;
  
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
              &lt;artifactId&gt;camel-core&lt;/artifactId&gt;
              &lt;version&gt;${camel.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
              &lt;artifactId&gt;camel-spring&lt;/artifactId&gt;
              &lt;version&gt;${camel.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
              &lt;artifactId&gt;camel-cxf&lt;/artifactId&gt;
              &lt;version&gt;${camel.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
              &lt;artifactId&gt;camel-servlet&lt;/artifactId&gt;
              &lt;version&gt;${camel.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
              &lt;artifactId&gt;camel-cxf-transport&lt;/artifactId&gt;
              &lt;version&gt;${camel.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
              &lt;artifactId&gt;camel-spring-javaconfig&lt;/artifactId&gt;
              &lt;version&gt;${camel.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
              &lt;artifactId&gt;camel-freemarker&lt;/artifactId&gt;
              &lt;version&gt;${camel.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
              &lt;artifactId&gt;camel-jackson&lt;/artifactId&gt;
              &lt;version&gt;${camel.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
              &lt;artifactId&gt;camel-mail&lt;/artifactId&gt;
              &lt;version&gt;${camel.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
              &lt;artifactId&gt;camel-metrics&lt;/artifactId&gt;
              &lt;version&gt;${camel.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
              &lt;artifactId&gt;camel-sql&lt;/artifactId&gt;
              &lt;version&gt;${camel.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
              &lt;artifactId&gt;camel-swagger&lt;/artifactId&gt;
              &lt;version&gt;${camel.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
              &lt;artifactId&gt;camel-spring-boot&lt;/artifactId&gt;
              &lt;version&gt;${camel.version}&lt;/version&gt; &lt;!-- use the same version as your Camel core version --&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
              &lt;artifactId&gt;camel-gson&lt;/artifactId&gt;
              &lt;version&gt;${camel.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;!-- &lt;dependency&gt; &lt;groupId&gt;org.apache.camel&lt;/groupId&gt; &lt;artifactId&gt;camel-spring-ws&lt;/artifactId&gt; 
              &lt;version&gt;${camel.version}&lt;/version&gt; &lt;/dependency&gt; --&gt;
          &lt;!-- &lt;dependency&gt; &lt;groupId&gt;org.apache.camel&lt;/groupId&gt; &lt;artifactId&gt;camel-cxf&lt;/artifactId&gt; 
              &lt;version&gt;${camel.version}&lt;/version&gt; &lt;/dependency&gt; --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.projectlombok&lt;/groupId&gt;
              &lt;artifactId&gt;lombok&lt;/artifactId&gt;
              &lt;version&gt;1.12.2&lt;/version&gt;
              &lt;scope&gt;provided&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;!-- &lt;dependency&gt; &lt;groupId&gt;org.apache.camel&lt;/groupId&gt; &lt;artifactId&gt;camel-restlet&lt;/artifactId&gt; 
              &lt;version&gt;${camel.version}&lt;/version&gt; use the same version as your Camel core 
              version &lt;/dependency&gt; --&gt;
          &lt;!-- &lt;dependency&gt; &lt;groupId&gt;org.restlet.jee&lt;/groupId&gt; &lt;artifactId&gt;org.restlet.ext.spring&lt;/artifactId&gt; 
              &lt;version&gt;${restlet-version}&lt;/version&gt; &lt;/dependency&gt; --&gt;
  
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
              &lt;scope&gt;test&lt;/scope&gt;
              &lt;exclusions&gt;
                  &lt;exclusion&gt;
                      &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                      &lt;artifactId&gt;spring-boot-starter-logging&lt;/artifactId&gt;
                  &lt;/exclusion&gt;
              &lt;/exclusions&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
              &lt;artifactId&gt;camel-test&lt;/artifactId&gt;
              &lt;version&gt;${camel.version}&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
              &lt;artifactId&gt;camel-test-spring&lt;/artifactId&gt;
              &lt;version&gt;${camel.version}&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
  
  
          &lt;!-- informix dependency --&gt;
  
  
          &lt;dependency&gt;
              &lt;groupId&gt;com.informix.jdbc&lt;/groupId&gt;
              &lt;artifactId&gt;com.springsource.com.informix.jdbc&lt;/artifactId&gt;
              &lt;version&gt;3.0.0.JC3&lt;/version&gt;
          &lt;/dependency&gt;
  
  
  
          &lt;!-- Hibernate --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-entitymanager&lt;/artifactId&gt;
              &lt;version&gt;${hibernate.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
  
          &lt;!-- &lt;dependency&gt; &lt;groupId&gt;org.hibernate&lt;/groupId&gt; &lt;artifactId&gt;hibernate-c3p0&lt;/artifactId&gt; 
              &lt;version&gt;${hibernate.version}&lt;/version&gt; &lt;/dependency&gt; --&gt;
  
          &lt;!-- &lt;dependency&gt; &lt;groupId&gt;junit&lt;/groupId&gt; &lt;artifactId&gt;junit&lt;/artifactId&gt; 
              &lt;version&gt;${junit.version}&lt;/version&gt; &lt;scope&gt;test&lt;/scope&gt; &lt;/dependency&gt; --&gt;
  
          &lt;!-- LOG4J DEPENDENCY --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;log4j&lt;/groupId&gt;
              &lt;artifactId&gt;log4j&lt;/artifactId&gt;
              &lt;version&gt;${log4j.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
      &lt;/dependencies&gt;
  
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
              &lt;/plugin&gt;
  
          &lt;/plugins&gt;
      &lt;/build&gt;
      &lt;repositories&gt;
          &lt;repository&gt;
              &lt;id&gt;com.springsource.repository.bundles.release&lt;/id&gt;
              &lt;name&gt;SpringSource Enterprise Bundle Repository - SpringSource Bundle Releases&lt;/name&gt;
              &lt;url&gt;http://repository.springsource.com/maven/bundles/release&lt;/url&gt;
          &lt;/repository&gt;
  
          &lt;repository&gt;
              &lt;id&gt;com.springsource.repository.bundles.external&lt;/id&gt;
              &lt;name&gt;SpringSource Enterprise Bundle Repository - External Bundle Releases&lt;/name&gt;
              &lt;url&gt;http://repository.springsource.com/maven/bundles/external&lt;/url&gt;
          &lt;/repository&gt;
  
      &lt;/repositories&gt;
  
  &lt;/project&gt;
  </code></pre>