Calling Java developers: Spring Cloud GCP 1.0 is now generally available
Spring Cloud GCP is a project in the Spring Cloud family that helps Java developers build Spring Boot applications that consume Google Cloud services easily and idiomatically. We’re excited to announce the general availability of Spring Cloud GCP 1.0.
Developed in collaboration with the Spring Team at Pivotal, this project implements familiar Spring idioms and abstractions to bring the benefits of Spring and Spring Boot to Java developers using GCP services. This way, Spring Cloud lets Java developers write more maintainable applications with less boilerplate code and simpler configuration, and that are portable in a hybrid on-premises and cloud-based environment.
Spring Cloud GCP 1.0 includes the following Spring Boot starter integrations:
These Spring Boot integrations (or “starters”) automatically discover credentials from the Google Cloud SDK, the runtime environment (e.g., App Engine), or a custom location. In addition, these starters are integrated with Cloud Foundry and GCP Service Broker, so they can simply auto-configure services and access credentials from there.
For example, adding the Spring Cloud GCP Trace dependency automatically adds distributed tracing capability to your application and stores traces to Stackdriver Trace for analysis. If you add the Spring Cloud GCP Logging dependency, then log messages are stored in Stackdriver Logging with log correlation via the trace ID, as you can see here:
What comes after Spring Cloud GCP 1.0?
We’re already working on more integrations based on community feedback and we’ve recently released Spring Cloud GCP 1.1.0.M1, which has a preview of Spring Data Cloud Spanner and support for Spring Cloud Config.
For example, here’s how to map a class to a Cloud Spanner table:
Then, you can create a data access object using Spring Data repository. Note that this Spring Data repository is no different for Cloud Spanner as it is for another RDBMS. That means you can easily migrate between a traditional RDBMS and Cloud Spanner.
You can easily read/write data from/to Cloud Spanner using the repository:
Best of all, when using Spring Data REST, you can expose the repository as a RESTful service simply by using an annotation:
Learn more about Spring Cloud GCP
There are a number of resources to learn more about Spring Cloud GCP to get you started quickly:
Also, be sure to check out the latest walkthrough of the Spring Cloud GCP project by Pivotal’s Josh Long and Google’s Ray Tsang at Google Cloud Next 2018. They'll take you through a whirlwind tour of Cloud SQL, Cloud Spanner, Stackdriver Trace, and Cloud Pub/Sub integrations.
As a bonus, at the end of the video you'll learn how to classify pictures of cats using AI.