Jump to Content
Application Development

Calling Java developers: Spring Cloud GCP 1.0 is now generally available

August 8, 2018
Mike Eltsufin

Software Engineer

Ray Tsang

Developer Advocate

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:

https://storage.googleapis.com/gweb-cloudblog-publish/images/gcp_spring_cloud.max-1100x1100.png

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:

https://storage.googleapis.com/gweb-cloudblog-publish/images/Spring_Cloud_Trace.max-1500x1500.png

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:

Loading...

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.

Loading...

You can easily read/write data from/to Cloud Spanner using the repository:

Loading...

Best of all, when using Spring Data REST, you can expose the repository as a RESTful service simply by using an annotation:

Loading...

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.

Video Thumbnail

Help us make Spring Cloud GCP better

We are working on Spring Cloud GCP because we want GCP to be a great place for Java developers to build and run Spring Boot applications. We’re looking for feedback on the project. Please contribute issues and feature requests on our spring-cloud-gcp GitHub repository.

Posted in