|
1 | 1 | # Spring Boot based Hello World app |
2 | 2 |
|
3 | | -## Requirements |
4 | | -* [Apache Maven](http://maven.apache.org) 3.1 or greater |
5 | | -* JDK 8 in order to run |
6 | | -* [Cloud SDK for Managed VMs](https://cloud.google.com/appengine/docs/managed-vms/) |
| 3 | +This sample shows how to run a [Spring Boot][spring-boot] application on [Google |
| 4 | +Cloud Platform][cloud-java]. It uses the [Google App Engine flexible |
| 5 | +environment][App Engine-flexible]. |
7 | 6 |
|
8 | | -## Run the Application locally |
9 | | -1. Set the correct Cloud SDK project via `gcloud config set project YOUR_PROJECT` |
10 | | -id of your application. |
11 | | -2. Run `mvn spring-boot:run` |
12 | | -4. Visit http://localhost:8080 |
| 7 | +[App Engine-flexible]: https://cloud.google.com/appengine/docs/flexible/ |
| 8 | +[cloud-java]: https://cloud.google.com/java/ |
| 9 | +[spring-boot]: http://projects.spring.io/spring-boot/ |
13 | 10 |
|
14 | | -## Deploy to AppEngine Managed VMs |
15 | 11 |
|
16 | | -5. `mvn gcloud:deploy` |
17 | | -6. Visit `http://YOUR_PROJECT.appspot.com`. |
| 12 | +## Before you begin |
| 13 | + |
| 14 | +This sample assumes you have [Java 8][java8] installed. |
| 15 | + |
| 16 | +[java8]: http://www.oracle.com/technetwork/java/javase/downloads/ |
| 17 | + |
| 18 | +### Download Maven |
| 19 | + |
| 20 | +These samples use the [Apache Maven][maven] build system. Before getting |
| 21 | +started, be sure to [download][maven-download] and [install][maven-install] it. |
| 22 | +When you use Maven as described here, it will automatically download the needed |
| 23 | +client libraries. |
| 24 | + |
| 25 | +[maven]: https://maven.apache.org |
| 26 | +[maven-download]: https://maven.apache.org/download.cgi |
| 27 | +[maven-install]: https://maven.apache.org/install.html |
| 28 | + |
| 29 | +### Create a Project in the Google Cloud Platform Console |
| 30 | + |
| 31 | +If you haven't already created a project, create one now. Projects enable you to |
| 32 | +manage all Google Cloud Platform resources for your app, including deployment, |
| 33 | +access control, billing, and services. |
| 34 | + |
| 35 | +1. Open the [Cloud Platform Console][cloud-console]. |
| 36 | +1. In the drop-down menu at the top, select **Create a project**. |
| 37 | +1. Give your project a name. |
| 38 | +1. Make a note of the project ID, which might be different from the project |
| 39 | + name. The project ID is used in commands and in configurations. |
| 40 | + |
| 41 | +[cloud-console]: https://console.cloud.google.com/ |
| 42 | + |
| 43 | +### Enable billing for your project. |
| 44 | + |
| 45 | +If you haven't already enabled billing for your project, [enable |
| 46 | +billing][enable-billing] now. Enabling billing allows the application to |
| 47 | +consume billable resources such as running instances and storing data. |
| 48 | + |
| 49 | +[enable-billing]: https://console.cloud.google.com/project/_/settings |
| 50 | + |
| 51 | +### Install the Google Cloud SDK. |
| 52 | + |
| 53 | +If you haven't already installed the Google Cloud SDK, [install and initialize |
| 54 | +the Google Cloud SDK][cloud-sdk] now. The SDK contains tools and libraries that |
| 55 | +enable you to create and manage resources on Google Cloud Platform. |
| 56 | + |
| 57 | +[cloud-sdk]: https://cloud.google.com/sdk/ |
| 58 | + |
| 59 | +### Install the Google App Engine SDK for Java |
| 60 | + |
| 61 | + |
| 62 | +``` |
| 63 | +gcloud components update app-engine-java |
| 64 | +gcloud components update |
| 65 | +``` |
| 66 | + |
| 67 | + |
| 68 | +## Run the application locally |
| 69 | + |
| 70 | +1. Set the correct Cloud SDK project via `gcloud config set project |
| 71 | + YOUR_PROJECT` to the ID of your application. |
| 72 | +1. Run `mvn spring-boot:run` |
| 73 | +1. Visit http://localhost:8080 |
| 74 | + |
| 75 | + |
| 76 | +## Deploy to App Engine flexible environment |
| 77 | + |
| 78 | +1. `mvn gcloud:deploy` |
| 79 | +1. Visit `http://YOUR_PROJECT.appspot.com`. |
| 80 | + |
| 81 | + |
| 82 | +Java is a registered trademark of Oracle Corporation and/or its affiliates. |
| 83 | + |
0 commit comments