spring.config.import
vs. using BootstrapConfiguration (via spring-cloud-starter-bootstrap
) ? Our project has a bootstrap configuration which loads a property source into the context. We're trying to understand if whether we need to implement those ConfigData classes or if we can get by just adding the spring-cloud-starter-bootstrap
dependency
Hey friends. I am trying to run unit tests in my spring-cloud-gcp-storage-starter application. The application works perfectly because it can pull the correct ENV variables to start the GCP client. In the unit test context, it crashes that the credentials are not available. Is there a recommended way to get this library to support running in a unit test context? I need to point the Storage client to a localhost GCP storage server and to run without passing credentials.
java.io.IOException: The Application Default Credentials are not available. They are available if running in Google Compute Engine. Otherwise, the environment variable GOOGLE_APPLICATION_CREDENTIALS must be defined pointing to a file defining the credentials. See https://developers.google.com/accounts/docs/application-default-credentials for more information.
Hi there,
I use this dependency in my project:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-gcp-starter-trace</artifactId>
</dependency>
With
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-gcp-dependencies</artifactId>
<version>1.2.6.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
But at runtime I have a zipkin class not found exception:
ava.lang.NoClassDefFoundError: zipkin2.Endpoint$Builder
at java.base/java.lang.invoke.MethodType.throwNoClassDefFoundError(MethodType.java:380)
at java.base/java.lang.invoke.MethodType.vmResolveFromMethodDescriptorString(MethodType.java:362)
at java.base/java.lang.invoke.MethodHandle.sendResolveMethodHandle(MethodHandle.java:1227)
at java.base/java.lang.invoke.MethodHandle.getCPMethodHandleAt(Native Method)
at java.base/java.lang.invoke.MethodHandle.resolveInvokeDynamic(MethodHandle.java:1074)
at io.lettuce.core.tracing.BraveTracing$Builder.<init>(BraveTracing.java:112)
at io.lettuce.core.tracing.BraveTracing$Builder.<init>(BraveTracing.java:106)
at io.lettuce.core.tracing.BraveTracing.builder(BraveTracing.java:98)
at org.springframework.cloud.sleuth.autoconfig.instrument.redis.LazyTracing.braveTracing(TraceLettuceClientResourcesBeanPostProcessor.java:133)
at org.springframework.cloud.sleuth.autoconfig.instrument.redis.LazyTracing.isEnabled(TraceLettuceClientResourcesBeanPostProcessor.java:112)
at io.lettuce.core.RedisChannelHandler.<init>(RedisChannelHandler.java:88)
at io.lettuce.core.StatefulRedisConnectionImpl.<init>(StatefulRedisConnectionImpl.java:76)
at io.lettuce.core.RedisClient.newStatefulRedisConnection(RedisClient.java:661)
at io.lettuce.core.RedisClient.connectStandaloneAsync(RedisClient.java:277)
at io.lettuce.core.RedisClient.connect(RedisClient.java:211)
at org.springframework.data.redis.connection.lettuce.StandaloneConnectionProvider.lambda$getConnection$1(StandaloneConnectionProvider.java:115)
at org.springframework.data.redis.connection.lettuce.StandaloneConnectionProvider$$Lambda$1215.0000000040947880.get(Unknown Source)
at java.base/java.util.Optional.orElseGet(Optional.java:369)
at org.springframework.data.redis.connection.lettuce.StandaloneConnectionProvider.getConnection(StandaloneConnectionProvider.java:115)
at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$ExceptionTranslatingConnectionProvider.getConnection(LettuceConnectionFactory.java:1459)
at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$SharedConnection.getNativeConnection(LettuceConnectionFactory.java:1247)
at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$SharedConnection.getConnection(LettuceConnectionFactory.java:1230)
at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory.getSharedReactiveConnection(LettuceConnectionFactory.java:989)
at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory.getReactiveConnection(LettuceConnectionFactory.java:445)
at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory.getReactiveConnection(LettuceConnectionFactory.java:98)
at org.springframework.boot.actuate.redis.RedisReactiveHealthIndicator$$Lambda$1187.00000000409473B0.get(Unknown Source)
at reactor.core.publisher.MonoSupplier.call(MonoSupplier.java:85)
at reactor.core.publisher.FluxSubscribeOnCallable$CallableSubscribeOnSubscription.run(FluxSubscribeOnCallable.java:227)
at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:68)
at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:28)
at java.base/java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:264)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
at java.base/java.util.concurrent.ThreadP
LogstashMarkersJsonProvider
?
Hi all, I have a Spring Boot application that I've deployed to Google App Engine. I'm trying to configure it to use secrets stored in GCP Secret Manager. I've added spring-cloud-gcp-starter-secretmanager:2.0.0
to my project and added this property to my application.ymldatabase-name: ${sm://projects/<my-project>/secrets/db-name}
However I know the secret isn't getting resolved because when I deploy and run the app, I see this in the logsorg.postgresql.util.PSQLException: FATAL: database "//projects/<my-project>/secrets/db-name" does not exist
I don't see any output specific to secretmanager, so I can't tell if I've misconfigured something and secretmanager isn't even getting invoked, or if it is getting invoked, and simply can't resolve the secret. I'm using the default properties listed here: https://cloud.spring.io/spring-cloud-static/spring-cloud-gcp/current/reference/html/#configuration-10 and I've already verified that my GAE service account has the correct access to the secrets.
Anyone know what the output I'm seeing might indicate? Thanks in advance.
@meltsufin Thank you. I need to make a correction to my post above though. It turns out my secrets in application.yml are getting resolved just fine. However I should have stated that the following configuration is located in bootstrap.yml
database-name: ${sm://projects/<my-project>/secrets/db-name}
So it's the secret in bootstrap.yml that's not getting resolved. I would rather add this configuration to application.yml and then I suspect all would be well. The problem is when I add the spring-cloud-gcp-starter-secretmanager:2.0.0
dependency to my project, I get this error when I try to run:
java.lang.IllegalArgumentException: A database name must be provided.
It seems that it wants the spring.cloud.gcp.sql.database-name
property defined in bootstrap.yml. When I move that configuration there, the app runs again. However, it seems I can't resolve the secret in bootstrap.yml.
Any idea why it wants database-name
defined in bootstrap.yml? Thanks again
spring-cloud-gcp-starter-data-firestore
library using Gradle. I created a project using start.spring.io which seems to have included the correct dependency management config, but when I try to use Firestore classes (e.g. FirestoreTemplate
), none of them can be found. The entire com.google.cloud.spring.data
package can't be found at all.