Spring Cloud Spring JDBC

2024-01-09 17:51 更新

Spring Cloud GCP添加了與Spring JDBC的集成, 因此您可以使用Spring JDBC或依賴于它的其他庫(如Spring Data JPA)在Google Cloud SQL中運(yùn)行MySQL或PostgreSQL數(shù)據(jù)庫。

Spring Cloud GCP通過兩個(gè)Spring Boot入門程序的形式提供了Cloud SQL支持,一個(gè)用于MySQL,另一個(gè)用于PostgreSQL。入門者的作用是從屬性中讀取配置并采用默認(rèn)設(shè)置,從而使用戶體驗(yàn)盡可能簡單地連接到MySQL和PostgreSQL。

Maven坐標(biāo),使用Spring Cloud GCP BOM:

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-gcp-starter-sql-mysql</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-gcp-starter-sql-postgresql</artifactId>
</dependency>

Gradle坐標(biāo):

dependencies {
    compile group: 'org.springframework.cloud', name: 'spring-cloud-gcp-starter-sql-mysql'
    compile group: 'org.springframework.cloud', name: 'spring-cloud-gcp-starter-sql-postgresql'
}
以上內(nèi)容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)