Jump to Content
Application Modernization

Spring Cloud GCP 4.0 is out! Let’s upgrade the sample Bank of Anthos app.

February 28, 2023
https://storage.googleapis.com/gweb-cloudblog-publish/images/opensource.max-2500x2500.jpg
Aaron Wanjala

Java Developer Advocate

Announcing Spring Cloud GCP 4.0! Plus a feature overview and upgrade walkthrough

Try Google Cloud

Start building on Google Cloud with $300 in free credits and 20+ always free products.

Free trial

We’re excited to announce that Spring Cloud GCP version 4.0 is now generally available! In this post, we’ll be describing what the new major version has to offer, and demonstrating the process of using the migration guide on one of our reference architectures, Bank of Anthos.

What’s new?

With this release, Spring Cloud GCP officially supports Spring Boot 3.x. However, this migration involves a number of breaking changes as outlined in the migration guide. The full list of changes made is available on Github, but the one of the most significant differences is that Java 17 is now a minimum requirement.

https://storage.googleapis.com/gweb-cloudblog-publish/images/Spring_Cloud_GCP_4.0.max-1200x1200.jpg

Another notable feature of this release is the addition of starter artifacts – Spring Boot starters for Google Cloud – that provide dependencies and auto-configurations for 80+ Google Client libraries. Just as the name suggests, these starters can serve as helpful starting points when working with a new client library. For now, they’re in preview. 

These starters are not included in the BOM by default and need to be added as a dependency to your project before they can be used. For example, if you wanted to get started with Cloud Text-to-Speech, you would include the following:

Loading...

The upgrade process

We prepared a migration guide to help answer any questions involved with moving from 3.x to 4.x.  Let’s follow those instructions to migrate Bank of Anthos.

We’ll start by cloning and building the application before the upgrade, according to the quickstart and development guide:

Loading...

At the end of this, you should see a “deployment stabilized” message:

Loading...

With the environment set up for development, we’re ready to move on to the actual migration. The migration is already complete at time of writing, but here’s the full list of changes made:

With those changes in place, the app is upgraded and ready to re-deploy!

Live example

For a finished example of this migration, check out the Bank of Anthos repository on Github. It’s an excellent sample application that showcases a polyglot Java & Python app, served on Kubernetes and Google Cloud. All CI/CD and configurations are open source, so it may be instructive as you approach this migration.

Thanks for reading, and feel free to provide comments or feedback on Twitter, or in the issues section of the repository.

Posted in