title: Using Spring Boot 2.0 with Tomcat 7.0.82
body: <p>I have a project that uses Spring Boot 2.0.0.RC2. I need to deploy it to a customer environment using traditional deployment for Tomcat 7.0.82. 
  I've managed to build a war that can be deployed successfully by configuring <code>web.xml</code> in a typical way for Spring applications (with DispatcherServlet) instead of using <code>SpringBootServletInitializer</code>.</p>
  
  <p>I also would like to have a quick way of starting the app on local environment using an embedded Tomcat container by simply running the main method in the application class with <code>@SpringBootApplication</code> annotation. It works fine if I'm using the default Tomcat version (8.5.28). However, I would like to start the embedded container also in 7.0.82 version. This is important for me for another reason - I'm using SpringBootTest and it would be nice if those tests run on the exact same container as the customer environment. Unfortunately, I can't use the Spring Boot parent POM and override <code>tomcat.version</code> property.</p>
  
  <p>I've tried <code>@SpringBootApplication(exclude = ServletWebServerFactoryAutoConfiguration.class)</code> create <code>TomcatServletWebServerFactory</code> bean manually</p>
  
  <pre><code>@Bean
  public ServletWebServerFactory tomcatServletWebServerFactory() {
      return new TomcatServletWebServerFactory();
  }
  </code></pre>
  
  <p>and add tomcat 7.0.82 dependencies explicitly in <code>pom.xml</code> (${tomcat.version} = 7.0.82):</p>
  
  <pre><code>&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;exclusions&gt;
          &lt;exclusion&gt;
              &lt;groupId&gt;org.apache.tomcat&lt;/groupId&gt;
              &lt;artifactId&gt;tomcat-annotations-api&lt;/artifactId&gt;
          &lt;/exclusion&gt;
          &lt;exclusion&gt;
              &lt;groupId&gt;org.apache.tomcat.embed&lt;/groupId&gt;
              &lt;artifactId&gt;tomcat-embed-core&lt;/artifactId&gt;
          &lt;/exclusion&gt;
          &lt;exclusion&gt;
              &lt;groupId&gt;org.apache.tomcat.embed&lt;/groupId&gt;
              &lt;artifactId&gt;tomcat-embed-el&lt;/artifactId&gt;
          &lt;/exclusion&gt;
          &lt;exclusion&gt;
              &lt;groupId&gt;org.apache.tomcat.embed&lt;/groupId&gt;
              &lt;artifactId&gt;tomcat-embed-websocket&lt;/artifactId&gt;
          &lt;/exclusion&gt;
      &lt;/exclusions&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.apache.tomcat&lt;/groupId&gt;
      &lt;artifactId&gt;tomcat-annotations-api&lt;/artifactId&gt;
      &lt;version&gt;${tomcat.version}&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.apache.tomcat&lt;/groupId&gt;
      &lt;artifactId&gt;tomcat-util&lt;/artifactId&gt;
      &lt;version&gt;${tomcat.version}&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.apache.tomcat.embed&lt;/groupId&gt;
      &lt;artifactId&gt;tomcat-embed-core&lt;/artifactId&gt;
      &lt;version&gt;${tomcat.version}&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.apache.tomcat.embed&lt;/groupId&gt;
      &lt;artifactId&gt;tomcat-embed-el&lt;/artifactId&gt;
      &lt;version&gt;${tomcat.version}&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.apache.tomcat.embed&lt;/groupId&gt;
      &lt;artifactId&gt;tomcat-embed-websocket&lt;/artifactId&gt;
      &lt;version&gt;${tomcat.version}&lt;/version&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>but I'm still getting a <code>java.lang.NoClassDefFoundError: org/apache/tomcat/util/scan/StandardJarScanFilter</code> error.</p>
  
  <p>Could you please advise if there is any way to meet my requirements?</p>