I have a Spring boot app running on Google Cloud Run, and I want to connect to a postgres instance running on Google Cloudsql. I am able to connect using Spring Cloud GCP starter project.
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-gcp-starter-sql-postgresql</artifactId>
</dependency>
But I don't want to add this dependency.
I was able to connect from my local app by using using the postgressql plugin and specifying spring.datasource.url=***
after creating a Cloud proxy.
But when I tried doing the same from cloud run after using gcloud beta run deploy --add-cloudsql-instances <INSTANCE-ID>
it doesn't work. According to https://cloud.google.com/run/docs/configuring/connect-cloudsql, --add-cloudsql-instances
automatically creates a Cloud proxy. So why doesn't it work?
Thanks.