Spring Cloud GCP5.8.0

Spring Cloud GCP 專案讓 Spring Framework 成為 Google Cloud Platform (GCP) 的一等公民。

Spring Cloud GCP 已不再是 Spring Cloud 發行列車的一部分。新的儲存庫位置是 https://github.com/GoogleCloudPlatform/spring-cloud-gcp。如果您要從 1.x 版本升級,請查看遷移指南,以從 1.x 版本升級到 2.0.0(或更高版本)。

功能

Spring Cloud GCP 提供了廣泛的程式庫集合,讓從 Spring Framework 應用程式使用 Google Cloud Platform 更加容易。

專案功能包括

  • Spring Cloud GCP Pub/Sub 支援 (Spring Integration 和 Spring Cloud Stream Binder)

  • Spring Data Cloud Spanner

  • Spring Data Cloud Datastore

  • Spring Data Reactive Repositories for Cloud Firestore

  • Spring Data Cloud SQL

  • Google Cloud Logging、Tracing 和 Monitoring (原 Stackdriver)

  • Google Cloud Storage (Spring Resource 和 Spring Integration)

  • Google Cloud Vision API Template

  • 從 Google Cloud IAP 或 Firebase 標頭中提取 Spring Security 身分

  • 搭配 Spring Integration 的 Google Cloud BigQuery

  • Secret Manager 屬性來源和 API 範本

  • KMS 金鑰加密/解密 API 範本

開始使用

所有 Spring Cloud GCP 成品都透過 Maven Central 提供。

物料清單 (BOM)

如果您使用 Maven,您應該先將 Spring Cloud GCP 物料清單 (BOM) 新增到您的 pom.xml 中。這將幫助您管理專案中 spring-cloud-gcp 依賴項的版本號碼。

<dependencyManagement>
   <dependencies>
       <dependency>
           <groupId>com.google.cloud</groupId>
           <artifactId>spring-cloud-gcp-dependencies</artifactId>
           <version>5.8.0</version>
           <type>pom</type>
           <scope>import</scope>
       </dependency>
   </dependencies>
</dependencyManagement>

Starter 依賴項

Spring Cloud GCP 透過 Maven 提供 starter 依賴項,以便輕鬆依賴程式庫的不同模組。每個 starter 都包含開始使用其對應 Spring Cloud GCP 模組所需的所有依賴項和傳遞依賴項。

程式碼範例

學習如何使用 Spring Cloud GCP 的最佳方式是參考 Github 上的範例應用程式。

下表重點介紹了 Spring Cloud GCP 中最常用整合的幾個範例。

GCP 整合 範例應用程式
Cloud Pub/Sub spring-cloud-gcp-pubsub-sample
Cloud Spanner spring-cloud-gcp-data-spanner-sample
Cloud Datastore spring-cloud-gcp-data-datastore-sample
Cloud Firestore spring-cloud-gcp-data-firestore-sample
Cloud SQL (搭配 MySQL) spring-cloud-gcp-sql-mysql-sample
Cloud Storage spring-cloud-gcp-storage-resource-sample
Google Cloud Logging spring-cloud-gcp-logging-sample
Google Cloud Tracing spring-cloud-gcp-trace-sample
Cloud Vision spring-cloud-gcp-vision-api-sample
Cloud Security - IAP spring-cloud-gcp-security-iap-sample

Initializr

Spring Initializr 是一個工具,可為新的 Spring Boot 專案產生基礎程式碼。它處理產生 Maven 或 Gradle 建置檔案的工作,因此您不必手動新增依賴項。

Spring Initializr 提供 Spring Cloud GCP 的三個模組,您可以用來產生專案。

  • GCP 支援:GCP 支援模組包含每個 Spring Cloud GCP 整合的自動配置支援。只有在將所需的依賴項新增到您的專案時,才會啟用大多數自動配置程式碼。

  • GCP 訊息傳遞:Google Cloud Pub/Sub 整合可立即使用。

  • GCP 儲存空間:Google Cloud Storage 整合可立即使用。

聯絡我們

Spring Cloud GCP 是一個積極維護的專案,我們鼓勵使用者提出問題並詢問有關專案的問題。

我們積極監控以下溝通管道

Spring Initializr

快速開始您的專案

領先一步

VMware 提供培訓和認證,以加速您的進展。

瞭解更多

取得支援

Tanzu Spring 在一個簡單的訂閱中提供 OpenJDK™、Spring 和 Apache Tomcat® 的支援和二進位檔案。

瞭解更多

即將到來的活動

查看 Spring 社群中所有即將到來的活動。

檢視全部