spring.cloud.gcp.sql.enabled is ignored if specified in application.properties
See original GitHub issueDescribe the bug Introduced in https://github.com/GoogleCloudPlatform/spring-cloud-gcp/pull/131
The spring.cloud.gcp.sql.enabled
variable is ignored if it’s set using application.properties
.
I’m not sure if this is a deliberate design choice since EnvironmentPostProcessor
runs before those properties are applied.
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
A database name must be provided error when trying to ...
When postgresql & spring-cloud-gcp-starter are in the dependencies, spring cloud will try to configure the database. This looks like a bug, as ...
Read more >Spring Cloud GCP
If you provide your own spring.datasource.url , it will be ignored, unless you disable Cloud SQL auto configuration with spring.cloud.gcp.sql.enabled=false ...
Read more >Integrate Cloud Spanner with Spring Data - Google Cloud
Specify an instance and database. To specify the default instance and database, set the following configuration properties for your application: Property ...
Read more >Deploy a Spring Boot Application to Google App Engine
A detailed tutorial to deploying a Spring Boot app using MySQL to Google App Engine.
Read more >Getting Started with Spring Cloud GCP: Cloud SQL - Medium
In my last article, I gave a general overview of Spring Cloud GCP, explaining its ... Add dependencies; Set application properties ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
If the
EnvironmentPostProcessor
runs in the bootstrap context, it can only see what Spring Cloud has initiated. At that point, the application actually hasn’t even started and none of the usual environment preparation has happened yet.This is unfortunately a limitation of how the bootstrap context was designed and that lead to significant issues when using this feature with Spring Cloud Config Server (see https://github.com/spring-cloud/spring-cloud-commons/issues/737 for instance). The good news is that Spring Cloud
2020.0
has deprecated the bootstrap context in favour of a new mechnism introduced in Spring Boot 2.4 that makes this problem go away, see https://github.com/spring-cloud/spring-cloud-commons/issues/608#issuecomment-626340364.@Dattish I think you’re right that this has something to do with using bootstrap dependencies. In your setup, when Spring invokes the
CloudSqlEnvironmentPostProcessor
it doesn’t see properties fromapplication.properties
. Of course, if you removespring-cloud-gcp-starter-sql-postgresql
from yourpom.xml
CloudSqlEnvironmentPostProcessor
will be disabled because it won’t be on the classpath anymore.cc/ @snicoll In case you have some insight on why an
EnvironmentPostProcessor
might not be able to seeapplication.properties
whenboostrap.properties
is in the picture.