Skip to content

Commit

Permalink
refs #8 JPAにSpannerの接続情報を与えた
Browse files Browse the repository at this point in the history
  • Loading branch information
averak committed Jan 8, 2024
1 parent 6ecee90 commit e3ab50d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
5 changes: 5 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ project(":adapter") {
implementation(project(":usecase"))
implementation(rootProject.libs.spring.boot.starter.web)
implementation(rootProject.libs.spring.boot.starter.webflux)
implementation(rootProject.libs.spring.boot.starter.data.jpa)
implementation(rootProject.libs.google.cloud.spanner.spring)
implementation(rootProject.libs.google.cloud.spanner.jdbc)
implementation(rootProject.libs.google.cloud.spanner.hibernate)

testImplementation(rootProject.libs.spring.boot.starter.test)
}
Expand Down Expand Up @@ -197,6 +201,7 @@ dependencies {
implementation(project(":infrastructure"))
implementation(project(":usecase"))
implementation(libs.spring.boot.starter)
implementation(libs.spring.boot.starter.data.jpa)
implementation(libs.google.cloud.spanner.spring)
implementation(libs.google.cloud.spanner.jdbc)
}
Expand Down
1 change: 1 addition & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ spring-boot-starter-web = { module = "org.springframework.boot:spring-boot-start
spring-boot-starter-webflux = { module = "org.springframework.boot:spring-boot-starter-webflux", version.ref = "spring-boot" }
google-cloud-spanner-spring = "com.google.cloud:spring-cloud-gcp-starter-data-spanner:5.0.0"
google-cloud-spanner-jdbc = "com.google.cloud:google-cloud-spanner-jdbc:2.15.0"
google-cloud-spanner-hibernate = "com.google.cloud:google-cloud-spanner-hibernate-dialect:3.0.3"

[plugins]
gradle-git-properties = "com.gorylenko.gradle-git-properties:2.4.1"
Expand Down
9 changes: 3 additions & 6 deletions src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,13 @@ spring:
database: ${GCP_SPANNER_DATABASE:sandbox}
emulator-host: ${SPANNER_EMULATOR_HOST:localhost:9010}
datasource:
url: jdbc:cloudspanner:/projects/${spring.cloud.gcp.spanner.project-id}/instances/${spring.cloud.gcp.spanner.instance-id}/databases/${spring.cloud.gcp.spanner.database}
url: jdbc:cloudspanner://${spring.cloud.gcp.spanner.emulator-host}/projects/${spring.cloud.gcp.spanner.project-id}/instances/${spring.cloud.gcp.spanner.instance-id}/databases/${spring.cloud.gcp.spanner.database}
driver-class-name: com.google.cloud.spanner.jdbc.JdbcDriver
jpa:
hibernate:
ddl-auto: update
properties:
hibernate:
dialect: com.google.cloud.spanner.hibernate.SpannerDialect
show_sql: true
format_sql: true
database-platform: com.google.cloud.spanner.hibernate.SpannerDialect
show-sql: true
data:
redis:
host: ${REDIS_HOST:localhost}
Expand Down

0 comments on commit e3ab50d

Please sign in to comment.