Skip to content

Commit

Permalink
#: Add spanner adapt
Browse files Browse the repository at this point in the history
  • Loading branch information
zdu-strong committed Jan 18, 2025
1 parent c72bdfa commit 8bff44b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
5 changes: 4 additions & 1 deletion springboot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ Projects created by start.spring.io contain Spring Boot, a framework that makes
1. From https://adoptium.net install java v21, and choose Entire feature.<br/>
2. From https://code.visualstudio.com install Visual Studio Code.<br/>
Next, install extension "XML" and "Extension Pack for Java".<br/>
3. From https://dev.mysql.com/downloads/installer install MySQL, the password of the root user is set to 123456.<br/>
3. From https://www.docker.com install docker. Next, run the command:<br/>

docker run -d -p 9010:9010 gcr.io/cloud-spanner-emulator/emulator

4. Optional.<br/>
From https://dbeaver.io install DBeaver.<br/>

Expand Down
14 changes: 7 additions & 7 deletions springboot/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,25 @@
<properties>
<java.version>21</java.version>
<resource.delimiter>${}</resource.delimiter>
<database.jdbc.url>127.0.0.1:3306</database.jdbc.url>
<database.jdbc.url>/projects/my-project/instances/my-instance</database.jdbc.url>
<database.name>springboot_dev</database.name>
<database.username>root</database.username>
<database.password>123456</database.password>
<database.driver>com.mysql.cj.jdbc.Driver</database.driver>
<database.platform>com.springboot.project.common.database.CustomMySQLDialect</database.platform>
<database.driver>com.google.cloud.spanner.jdbc.JdbcDriver</database.driver>
<database.platform>com.springboot.project.common.database.CustomSpannerDialect</database.platform>
<storage.cloud.aliyun.enabled>false</storage.cloud.aliyun.enabled>
<storage.cloud.aliyun.endpoint></storage.cloud.aliyun.endpoint>
<storage.cloud.aliyun.bucketName></storage.cloud.aliyun.bucketName>
<storage.cloud.aliyun.accessKeyId></storage.cloud.aliyun.accessKeyId>
<storage.cloud.aliyun.accessKeySecret></storage.cloud.aliyun.accessKeySecret>
<database.spring.jpa.hibernate.ddl.auto>validate</database.spring.jpa.hibernate.ddl.auto>
<database.spring.liquibase.enabled>true</database.spring.liquibase.enabled>
<database.spring.jpa.hibernate.ddl.auto>update</database.spring.jpa.hibernate.ddl.auto>
<database.spring.liquibase.enabled>false</database.spring.liquibase.enabled>
<database.spring.datasource.url>
jdbc:mysql://${database.jdbc.url}/${database.name}?useUnicode=true&amp;characterEncoding=utf-8&amp;serverTimezone=UTC&amp;createDatabaseIfNotExist=true
jdbc:cloudspanner:${database.jdbc.url}/databases/${database.name};autocommit=false;autoConfigEmulator=true;usePlainText=true;lenient=true
</database.spring.datasource.url>
<database.sql.maven.plugin.url>${database.spring.datasource.url}</database.sql.maven.plugin.url>
<database.liquibase.maven.plugin.reference.url>
jdbc:mysql://${database.jdbc.url}/${env.LIQUIBASE_REFERENCE_DATABASE_NAME}?useUnicode=true&amp;characterEncoding=utf-8&amp;serverTimezone=UTC&amp;createDatabaseIfNotExist=true
jdbc:cloudspanner:${database.jdbc.url}/databases/${env.LIQUIBASE_REFERENCE_DATABASE_NAME};autocommit=false;autoConfigEmulator=true;usePlainText=true;lenient=true
</database.liquibase.maven.plugin.reference.url>
<is.development.mock.mode>true</is.development.mock.mode>
<google-cloud-spanner-jdbc.version>2.25.2</google-cloud-spanner-jdbc.version>
Expand Down

0 comments on commit 8bff44b

Please sign in to comment.