title: spring boot with gradle 3 and java 7 fails at server startup
body: <p>I have started playing with gradle and spring boot and picked some nice 'n easy tutorials as listed below. My setup is also listed below.</p>
  
  <p>Though the tutorial states that Java 1.8 is required, I have read that both gradle and boot can be used on Java 1.7 also.</p>
  
  <p>So, any reason why this simple tutorial shouldn't work for Java 1.7? Apparently ...</p>
  
  <p>I create my gradlew as follows: <code>gradle wrapper --gradle-version 3.0</code> and then run my gradle build command as ususal: <code>./gradlew build &amp;&amp; java -jar build/libs/gs-spring-boot-0.1.0.jar</code> in my project directory.</p>
  
  <p>Setup:</p>
  
  <ul>
  <li><p>OS: 12.04 LTS 32-bit</p></li>
  <li><p>java version "1.7.0_80"</p></li>
  <li><p>tutorials: </p>
  
  <ul>
  <li><p><a href="https://spring.io/guides/gs/spring-boot/#scratch" rel="nofollow">https://spring.io/guides/gs/spring-boot/#scratch</a></p></li>
  <li><p><a href="https://docs.gradle.org/current/userguide/gradle_wrapper.html" rel="nofollow">https://docs.gradle.org/current/userguide/gradle_wrapper.html</a></p></li>
  </ul></li>
  </ul>
  
  <p>build.gradle (<strong>NOTE</strong>: I specify target/sourceCompatibility = 1.7):</p>
  
  <pre><code>buildscript {
      repositories {
          mavenCentral()
      }
      dependencies {
          classpath("org.springframework.boot:spring-boot-gradle-plugin:1.4.0.RELEASE")
      }
  }
  
  apply plugin: 'java'
  apply plugin: 'eclipse'
  apply plugin: 'idea'
  apply plugin: 'spring-boot'
  
  jar {
      baseName = 'gs-spring-boot'
      version =  '0.1.0'
  }
  
  repositories {
      mavenCentral()
  }
  
  sourceCompatibility = 1.7
  targetCompatibility = 1.7
  
  dependencies {
      // tag::jetty[]
      compile("org.springframework.boot:spring-boot-starter-web") {
          exclude module: "spring-boot-starter-tomcat"
      }
      compile("org.springframework.boot:spring-boot-starter-jetty")
      // end::jetty[]
      // tag::actuator[]
      compile("org.springframework.boot:spring-boot-starter-actuator")
      // end::actuator[]
      testCompile("junit:junit")
  }
  </code></pre>
  
  <p>output:</p>
  
  <p>Note that the error occurs at server startup, i.e. here:
  <code>org.springframework.context.ApplicationContextException: Unable to start embedded container</code></p>
  
  <pre><code>vagrant@precise32:/vagrant/BootTutorial$ ./gradlew build &amp;&amp; java -jar build/libs/gs-spring-boot-0.1.0.jar
  :compileJava UP-TO-DATE
  :processResources UP-TO-DATE
  :classes UP-TO-DATE
  :findMainClass
  :jar
  :bootRepackage
  :assemble
  :compileTestJava UP-TO-DATE
  :processTestResources UP-TO-DATE
  :testClasses UP-TO-DATE
  :test UP-TO-DATE
  :check UP-TO-DATE
  :build
  
  BUILD SUCCESSFUL
  
  Total time: 4.835 secs
  
    .   ____          _            __ _ _
   /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
  ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
   \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
    '  |____| .__|_| |_|_| |_\__, | / / / /
   =========|_|==============|___/=/_/_/_/
   :: Spring Boot ::        (v1.4.0.RELEASE)
  
  2016-09-03 18:57:49.456  INFO 2043 --- [           main] hello.Application                        : Starting Application on precise32 with PID 2043 (/vagrant/BootTutorial/build/libs/gs-spring-boot-0.1.0.jar started by vagrant in /vagrant/BootTutorial)
  2016-09-03 18:57:49.518  INFO 2043 --- [           main] hello.Application                        : No active profile set, falling back to default profiles: default
  2016-09-03 18:57:50.136  INFO 2043 --- [           main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@65b0e5: startup date [Sat Sep 03 18:57:50 AEST 2016]; root of context hierarchy
  2016-09-03 18:57:58.795  WARN 2043 --- [           main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.context.ApplicationContextException: Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.
  2016-09-03 18:57:59.019 ERROR 2043 --- [           main] o.s.boot.SpringApplication               : Application startup failed
  
  org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.context.ApplicationContextException: Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.
          at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:137) ~[spring-boot-1.4.0.RELEASE.jar!/:1.4.0.RELEASE]
          at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:535) ~[spring-context-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]
          at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.4.0.RELEASE.jar!/:1.4.0.RELEASE]
          at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759) [spring-boot-1.4.0.RELEASE.jar!/:1.4.0.RELEASE]
          at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:369) [spring-boot-1.4.0.RELEASE.jar!/:1.4.0.RELEASE]
          at org.springframework.boot.SpringApplication.run(SpringApplication.java:313) [spring-boot-1.4.0.RELEASE.jar!/:1.4.0.RELEASE]
          at org.springframework.boot.SpringApplication.run(SpringApplication.java:1185) [spring-boot-1.4.0.RELEASE.jar!/:1.4.0.RELEASE]
          at org.springframework.boot.SpringApplication.run(SpringApplication.java:1174) [spring-boot-1.4.0.RELEASE.jar!/:1.4.0.RELEASE]
          at hello.Application.main(Application.java:13) [classes!/:na]
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_80]
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_80]
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_80]
          at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_80]
          at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) [gs-spring-boot-0.1.0.jar:na]
          at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) [gs-spring-boot-0.1.0.jar:na]
          at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) [gs-spring-boot-0.1.0.jar:na]
          at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:58) [gs-spring-boot-0.1.0.jar:na]
  Caused by: org.springframework.context.ApplicationContextException: Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.
          at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.getEmbeddedServletContainerFactory(EmbeddedWebApplicationContext.java:189) ~[spring-boot-1.4.0.RELEASE.jar!/:1.4.0.RELEASE]
          at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:162) ~[spring-boot-1.4.0.RELEASE.jar!/:1.4.0.RELEASE]
          at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:134) ~[spring-boot-1.4.0.RELEASE.jar!/:1.4.0.RELEASE]
          ... 16 common frames omitted
  
  vagrant@precise32:/vagrant/BootTutorial$
  </code></pre>