The plan is to have a prod
profile for the production environment which runs in tandem with a Cloud SQL Postgres-instance.
For this I require the spring-cloud-gcp-starter-sql-postgresql
dependency:
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>spring-cloud-gcp-starter-sql-postgresql</artifactId>
<version>4.1.4</version>
</dependency>
The problem: Whatever I try, this dependency seems to get injected to the Spring Boot auto-config chain somehow.
If I run the server locally I'd get
Error creating bean with name 'com.google.cloud.spring.autoconfigure.firestore.GcpFirestoreAutoConfiguration':
Unsatisfied dependency expressed through constructor parameter 1:
No qualifying bean of type 'com.google.cloud.spring.core.GcpProjectIdProvider' available:
expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
If thought I could fix this by chosing a different <scope>
for he dependency, but nothing I tried works - except <scope>test</scope>
.
<dependencies>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>spring-cloud-gcp-starter-sql-postgresql</artifactId>
<version>4.1.4</version>
<scope>test</scope>
</dependency>
</dependencies>
<profiles>
<profile>
<id>dev</id>
<dependencies>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>spring-cloud-gcp-starter-sql-postgresql</artifactId>
</dependency>
</dependencies>
</profile>
</profiles>
However, this is of course not what I want either.
All I want to do is declare spring-cloud-gcp-starter-sql-postgresql
and not influence the application in any way except certain profiles, like prod
, are activated.
I've tried the following:
spring:
cloud:
gcp:
core:
enabled: false
sql:
enabled: false
But I'd still get the same exception.
Is there a way do configure this the way I want to except for removing the dependency from the root?