App Engine is well suited to applications that are designed using a microservice architecture.
If you search on google how to deploy a Spring Boot project on Google App Engine, you will find a lot of old documentation, which talks about changing the Application code so that you are able to deploy it to the app engine.
For example, some mandatory steps mentioned are:
- You can only deploy a WAR file instead of a JAR file.
- You need to implement SpringBootServletInitializer
- Remove Tomcat Starter
- Add Servlet API dependency
- Exclude JUL to SLF4J Bridge
- adding logging.properties file with .info tag
Google’s GitHub link also mentions these steps as mandatory.
This sample demonstrates how to deploy a Spring Boot application on Google App Engine. See the Google App Engine…
Edit: Above documentation is Fixed after this issue was opened https://github.com/GoogleCloudPlatform/getting-started-java/issues/505
This is a lot of work
But thankfully all this is not required.
Now you can deploy a JAR file to App Engine Standard Environment without doing all these.
You just have to build the JAR and choose Java 11 runtime to deploy the app.
If you have an existing spring boot app, and you want to migrate to a JAR version from a WAR deployment, check this link
Migrating your App Engine app from Java 8 to Java 11 | App Engine standard environment for Java 11…
In addition to supporting the Java 8 runtime, App Engine now supports hosting your applications using the Java 11…
The Java 11 runtime does not include any web-serving framework, meaning you’re no longer limited to servlet-based frameworks.
You can use all the popular frameworks on App Engine with Java 11 Runtime
Before ending this article let’s discuss the differences in JAR and WAR
WAR file is simply a JAR file but contains only Web-related Java files like Servlets, JSP, HTML.
To execute a WAR file, a Web server or Web container is required, for example, Tomcat
JAR file contains Java-related resources like libraries, classes, etc. which you can run directly from the JDK, in Spring Boot jar Web server is embedded in the jar.
And one last thing, there is one more environment on Google App Engine, i.e Flexible Environment
On Flexible Environment Application instances run within Docker containers on Compute Engine virtual machines
One other important difference is that :
In Standard Environment, you get Scale to zero but in Flexible you will have at least minimum 1 instance running
For the complete difference between these two environments check this link
Choosing an App Engine environment | App Engine Documentation | Google Cloud
You can run your applications in App Engine using the flexible environment or standard environment. You can also choose…
You can also watch this video, all the steps are shown in the video
or take this CodeLab
A sample project is uploaded at this Github link
If you found this article useful, you know what to do now. Hit that clap button and star the GitHub repo follow me to get more articles and tutorials on your feed.