Last active
January 5, 2022 09:37
-
-
Save tfalvo/a5e6dff5f602c90f26f12e0d0ed3c0c2 to your computer and use it in GitHub Desktop.
GCP Cloud SQL + AppEngine + Spring Cloud GCP (Code sample)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
spring.cloud.gcp.sql.database-name=demo | |
spring.cloud.gcp.sql.instance-connection-name=[INSTANCE_CONNECTION_NAME] | |
# So app starts despite "table already exists" errors. | |
spring.datasource.continue-on-error=true | |
# Enforces database initialization | |
spring.datasource.initialization-mode=always | |
# Leave empty for root, uncomment and fill out if you specified a user | |
#spring.datasource.username= | |
# Uncomment if root password is specified | |
spring.datasource.password=demo | |
#spring.cloud.gcp.project-id= | |
#spring.cloud.gcp.credentials.location=file:/path/to/service-account.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<project xmlns="http://maven.apache.org/POM/4.0.0" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<parent> | |
<groupId>org.springframework.boot</groupId> | |
<artifactId>spring-boot-starter-parent</artifactId> | |
<version>2.0.3.RELEASE</version> | |
<relativePath/> <!-- lookup parent from repository --> | |
</parent> | |
<groupId>linaveo</groupId> | |
<artifactId>demo</artifactId> | |
<version>1.0</version> | |
<packaging>jar</packaging> | |
<properties> | |
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | |
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> | |
<java.version>1.8</java.version> | |
<appengine.maven.plugin>1.3.2</appengine.maven.plugin> | |
</properties> | |
<name>Spring Cloud GCP SQL MySQL Starter Code Sample</name> | |
<dependencyManagement> | |
<dependencies> | |
<dependency> | |
<groupId>org.springframework.cloud</groupId> | |
<artifactId>spring-cloud-gcp-dependencies</artifactId> | |
<version>1.1.0.BUILD-SNAPSHOT</version> | |
<type>pom</type> | |
<scope>import</scope> | |
</dependency> | |
</dependencies> | |
</dependencyManagement> | |
<dependencies> | |
<dependency> | |
<groupId>org.springframework.boot</groupId> | |
<artifactId>spring-boot-starter-web</artifactId> | |
</dependency> | |
<dependency> | |
<groupId>org.springframework.cloud</groupId> | |
<artifactId>spring-cloud-gcp-starter</artifactId> | |
</dependency> | |
<dependency> | |
<groupId>org.springframework.cloud</groupId> | |
<artifactId>spring-cloud-gcp-starter-sql-mysql</artifactId> | |
</dependency> | |
</dependencies> | |
<build> | |
<plugins> | |
<plugin> | |
<groupId>org.springframework.boot</groupId> | |
<artifactId>spring-boot-maven-plugin</artifactId> | |
</plugin> | |
<plugin> | |
<groupId>com.google.cloud.tools</groupId> | |
<artifactId>appengine-maven-plugin</artifactId> | |
<version>${appengine.maven.plugin}</version> | |
</plugin> | |
</plugins> | |
</build> | |
</project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The catch is we should have database property in first place as mentioned -
spring.cloud.gcp.sql.database-name=demo