title: How to use Tomcat 8 + Spring Boot + Maven
body: <p>According to the Reference API on <a href="http://docs.spring.io/spring-boot/docs/1.0.2.RELEASE/reference/htmlsingle/#howto-use-tomcat-8">Using Tomcat 8</a> and this <a href="http://spring.io/blog/2014/03/07/deploying-spring-boot-applications">Deploy Spring Boot Applications</a> tutorial it should be possible to use Tomcat 8 with <a href="http://projects.spring.io/spring-boot/">Spring Boot</a>, which uses Tomcat 7 as default.</p>
  
  <p>For some reason it is not working for me. What am I doing wrong?</p>
  
  <p><strong>pom.xml</strong></p>
  
  <pre><code>&lt;build&gt;
      &lt;plugins&gt;
          &lt;plugin&gt;
              &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
              &lt;version&gt;3.1&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;source&gt;1.7&lt;/source&gt;
                  &lt;target&gt;1.7&lt;/target&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
  &lt;/build&gt;
  &lt;properties&gt;
      &lt;tomcat.version&gt;8.0.3&lt;/tomcat.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-web&lt;/artifactId&gt;
          &lt;version&gt;1.0.2.RELEASE&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
          &lt;artifactId&gt;spring-webmvc&lt;/artifactId&gt;
          &lt;version&gt;4.0.5.RELEASE&lt;/version&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  </code></pre>
  
  <p></p>
  
  <p><strong>SampleController.java</strong></p>
  
  <pre><code>import org.springframework.boot.SpringApplication;
  import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
  import org.springframework.stereotype.Controller;
  import org.springframework.web.bind.annotation.RequestMapping;
  import org.springframework.web.bind.annotation.ResponseBody;
  
  @Controller
  @EnableAutoConfiguration
  public class SampleController {
  
      @RequestMapping("/")
      @ResponseBody
      String home() {
          return "Hello World!";
      }
  
      public static void main(String[] args) throws Exception {
          SpringApplication.run(SampleController.class, args);
      }
  }
  </code></pre>
  
  <p><strong>Output is <em>Starting Servlet Engine: Apache Tomcat/7.0.52</em></strong></p>
  
  <pre><code> :: Spring Boot ::        (v1.0.2.RELEASE)
  
  2014-06-09 13:55:27.688  INFO 5744 --- [           main] SampleController                         : Starting SampleController on CI01081252 with PID 5744 (started by TECBMEPI in D:\projetos\teclogica\testes automatizados\exemplo int db\workspace\spring-boot-tomcat8-maven)
  2014-06-09 13:55:27.730  INFO 5744 --- [           main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@33b45e9a: startup date [Mon Jun 09 13:55:27 BRT 2014]; root of context hierarchy
  2014-06-09 13:55:28.869  INFO 5744 --- [           main] .t.TomcatEmbeddedServletContainerFactory : Server initialized with port: 8081
  2014-06-09 13:55:29.117  INFO 5744 --- [           main] o.apache.catalina.core.StandardService   : Starting service Tomcat
  2014-06-09 13:55:29.118  INFO 5744 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/7.0.52
  2014-06-09 13:55:29.226  INFO 5744 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
  2014-06-09 13:55:29.226  INFO 5744 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 1498 ms
  2014-06-09 13:55:29.656  INFO 5744 --- [ost-startStop-1] o.s.b.c.e.ServletRegistrationBean        : Mapping servlet: 'dispatcherServlet' to [/]
  2014-06-09 13:55:29.658  INFO 5744 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean  : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
  2014-06-09 13:55:29.946  INFO 5744 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
  2014-06-09 13:55:30.035  INFO 5744 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto java.lang.String SampleController.home()
  2014-06-09 13:55:30.059  INFO 5744 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
  2014-06-09 13:55:30.059  INFO 5744 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
  2014-06-09 13:55:30.236  INFO 5744 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
  2014-06-09 13:55:30.257  INFO 5744 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8081/http
  2014-06-09 13:55:30.259  INFO 5744 --- [           main] SampleController                         : Started SampleController in 2.933 seconds (JVM running for 3.318)
  </code></pre>
  
  <p>I have already tried this <a href="http://docs.spring.io/spring-boot/docs/1.1.0.RC1/reference/htmlsingle/#howto-use-tomcat-8">newer RC version of Spring boot</a>, but still Tomcat 7 is loaded instead of 8.</p>
  
  <p>Also adding <code>&lt;java.version&gt;1.7&lt;/java.version&gt;</code> property didnt work.</p>
  
  <p>Tried "application.properties" as well. Port is set as specified on start-up, but version of Tomcat remains the default 7.</p>
  
  <p><strong>application.properties</strong></p>
  
  <pre><code>server.port=8081
  tomcat.version=8.0.3
  </code></pre>