Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
157 lines (119 sloc) 4.66 KB

SpringBoot HelloWorld for App Engine Standard (Java 8)

This sample demonstrates how to deploy a Spring Boot application on Google App Engine.

See the Google App Engine standard environment documentation for more detailed instructions.


  • Download and initialize the Cloud SDK

    gcloud init

  • Create an App Engine app within the current Google Cloud Project

    gcloud app create


Running locally

mvn appengine:run

To use vist: http://localhost:8080/


mvn appengine:deploy

To use vist:


mvn verify

As you add / modify the source code (src/main/java/...) it's very useful to add unit testing to (src/main/test/...). The following resources are quite useful:

For further information, consult the Java App Engine documentation.

Steps to convert a Spring Boot application for App Engine Standard

Use the WAR packaging

You must use WAR packaging to deploy into Google App Engine Standard.

If you generate a Spring Boot project from, make sure you switch to the full version view of the initializer site, and select WAR packaging.

If you have an existing JAR packaging project, you can convert it into a WAR project by:

  1. In pom.xml, change <packaging>jar</packaging> to <packaging>war</packaging>
  2. Create a new SpringBootServletInitializer implementation:
public class ServletInitializer extends SpringBootServletInitializer {
  protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
  return application.sources(YourApplication.class);

Remove Tomcat Starter

Google App Engine Standard deploys your WAR into a Jetty server. Spring Boot's starter includes Tomcat by default. This will introduce conflicts. Exclude Tomcat dependencies:


Do not include the Jetty dependencies. But you must include Servlet API dependency:


Add App Engine Standard Plugin

In the pom.xml, add the App Engine Standard plugin:


This plugin is used to run local development server as well as deploying the application into Google App Engine.

Add App Engine Configuration

Add a src/main/webapp/WEB-INF/appengine-web.xml:

<appengine-web-app xmlns="">

This configure is required for applications running in Google App Engine.

Exclude JUL to SLF4J Bridge

Spring Boot's default logging bridge conflicts with Jetty's logging system. To be able to capture the Spring Boot startup logs, you need to exclude org.slf4j:jul-to-slf4j dependency. The easiest way to do this is to set the dependency scope to provided, so that it won't be included in the WAR file:

<!-- Exclude any jul-to-slf4j -->

Out of memory errors

With Spring Boot >= 1.5.6, you may run into out of memory errors on startup. Please follow these instructions to work around this issue:

  1. Inside src/main/resources, adding a file with:
.level = INFO
  1. Inside src/main/webapp/WEB-INF/appengine-web.xml, add a config that points to the new file.
  <property name="java.util.logging.config.file" value="WEB-INF/classes/"/>
You can’t perform that action at this time.