Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: Spring Cloud 2024.0 and Spring Boot 3.4.1 #3411

Open
wants to merge 99 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 95 commits
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
d84f835
chore: test Spring Cloud 2024 upgrade
diegomarquezp Dec 9, 2024
9f52343
fix datastore tests
diegomarquezp Dec 9, 2024
20334f4
fix kotlin sample test
diegomarquezp Dec 10, 2024
8742fee
fix spanner autoconfig
diegomarquezp Dec 10, 2024
8b11f19
use latest spring-cloud-config in pubsub bus sample
diegomarquezp Dec 10, 2024
6401f87
wip pubsub stream binder test
diegomarquezp Dec 11, 2024
bc9ce20
update spring boot to 3.4.0
diegomarquezp Dec 11, 2024
5b8baec
adapt data-spanner to spring boot 3.4
diegomarquezp Dec 11, 2024
036da2b
fix value evaluation for SqlSpannerQuery
diegomarquezp Dec 12, 2024
9ee34b3
use value expression delegate in datastore
diegomarquezp Dec 12, 2024
57a9abf
restore unnecessary changes
diegomarquezp Dec 12, 2024
195fca8
fix datastore tests
diegomarquezp Dec 13, 2024
290c7a2
format
diegomarquezp Dec 13, 2024
69b95d6
Revert "format"
diegomarquezp Dec 13, 2024
210af44
fix style violations
diegomarquezp Dec 13, 2024
5ba9487
remove unused imports
diegomarquezp Dec 13, 2024
cb7d247
remove unused imports in autoconfigure
diegomarquezp Dec 16, 2024
da3e2e4
fix imports in pubsub emulator
diegomarquezp Dec 16, 2024
72f5be7
fix gql datastore query test
diegomarquezp Dec 16, 2024
ea12ab3
remove spring boot 3.2 compatibility check
diegomarquezp Dec 16, 2024
66b4439
remove config module
diegomarquezp Dec 16, 2024
aec62c4
remove unused module
diegomarquezp Dec 16, 2024
e4cfff5
fix secretmanager sample
diegomarquezp Dec 17, 2024
26127ee
fix whitespace in it
diegomarquezp Dec 17, 2024
0a6601a
add native config for alloydb sample
diegomarquezp Dec 17, 2024
3804221
Merge remote-tracking branch 'origin/main' into test-spring-cloud-2024
diegomarquezp Dec 17, 2024
da8e462
update libraries bom
diegomarquezp Dec 17, 2024
0eb38a7
remove unused method in pubsub
diegomarquezp Dec 17, 2024
da0214b
fix 2sa usage
diegomarquezp Dec 17, 2024
30d6ec8
fix spanner units
diegomarquezp Dec 17, 2024
6ac6cad
fix units in pubsub
diegomarquezp Dec 17, 2024
cc4dfa5
try new native config
diegomarquezp Dec 17, 2024
34b51ea
use custom placeholder configurer in secretmanager
diegomarquezp Dec 18, 2024
4da4251
fix style in secretmanager
diegomarquezp Dec 18, 2024
0feea0d
use static bean
diegomarquezp Dec 19, 2024
cac7952
add default value for secret manager sample config file
diegomarquezp Dec 19, 2024
19835e6
configure netty for firestore sample
diegomarquezp Dec 21, 2024
8363e28
fix netty usage for native image building in pubsub sample
diegomarquezp Dec 21, 2024
c386669
fix native tests for data-firestore
diegomarquezp Dec 23, 2024
dd81242
fix storage sample test
diegomarquezp Dec 23, 2024
170ad64
restore secret manager to latest of `main`
diegomarquezp Dec 23, 2024
10bf82b
fix pubsub binder units
diegomarquezp Dec 27, 2024
759d5a8
add recommended netty config for postgress samples
diegomarquezp Dec 27, 2024
7b82400
fix pubsub binder tests
diegomarquezp Dec 28, 2024
a6cdfce
upgrade to spring-boot 3.4.1
diegomarquezp Dec 28, 2024
e16c6de
remove placeholder configurer from secret manager
diegomarquezp Dec 28, 2024
a1858a5
restore datastore autoconfig
diegomarquezp Dec 28, 2024
cfa3fa4
restore graalvm config in main pom.xml
diegomarquezp Dec 28, 2024
a486b1f
remove unused import in stream binder
diegomarquezp Dec 28, 2024
c6369b9
cleanup of pubsub binder tests
diegomarquezp Dec 28, 2024
f4cf009
use spring boot 3.4.1 in samples
diegomarquezp Dec 28, 2024
3e8ea01
remove native config for alloydb sample
diegomarquezp Dec 28, 2024
b3fb48c
remove unused whitespace in poms
diegomarquezp Dec 28, 2024
cfd9bf0
Revert "fix storage sample test"
diegomarquezp Dec 28, 2024
14c40cc
try using unchanged firestore IT config
diegomarquezp Dec 30, 2024
be28c72
Revert "fix pubsub binder tests"
diegomarquezp Dec 30, 2024
c14b659
Reapply "fix pubsub binder tests"
diegomarquezp Dec 30, 2024
4eae5e7
test reverting changes in pubsub binder
diegomarquezp Dec 30, 2024
e719481
Revert "test reverting changes in pubsub binder"
diegomarquezp Dec 30, 2024
2afede2
add support for value expressions and query method evaluators in data…
diegomarquezp Dec 30, 2024
e858017
test both value expressions and query method expressions in datastore
diegomarquezp Dec 31, 2024
ea60c6b
fix style
diegomarquezp Dec 31, 2024
3b3c24e
fix style ii
diegomarquezp Dec 31, 2024
5306b59
introduce support for value expression delegate and query method eval…
diegomarquezp Jan 2, 2025
d7d3b9c
adapt spanner tests
diegomarquezp Jan 2, 2025
b2a6a04
standardize to parameterized booleans
diegomarquezp Jan 2, 2025
2130836
add support info on root readme
diegomarquezp Jan 2, 2025
48cd789
add spring cloud 2024 support info in gettin-started
diegomarquezp Jan 2, 2025
ce5d809
introduce 5.x to 6.x migration guide
diegomarquezp Jan 2, 2025
4015f3f
update project.version to 6.0.0-SNAPSHOT
diegomarquezp Jan 2, 2025
8a0eac3
Revert "remove config module"
diegomarquezp Jan 2, 2025
ce40125
update project.version in config integrations
diegomarquezp Jan 2, 2025
3eeef1e
update versions.txt
diegomarquezp Jan 2, 2025
0fabdbf
update project.version in spring-cloud-generator
diegomarquezp Jan 2, 2025
56351ab
retrigger tests
diegomarquezp Jan 2, 2025
ab3b097
fix checkstyle violations in spanner
diegomarquezp Jan 3, 2025
56d395d
fix checkstyle violations in datastore
diegomarquezp Jan 3, 2025
241dab3
Merge remote-tracking branch 'origin/main' into test-spring-cloud-2024
diegomarquezp Jan 3, 2025
eaf04dc
update valkey to 6.x
diegomarquezp Jan 3, 2025
dc1b24b
fix checkstyle in data-spanner
diegomarquezp Jan 3, 2025
37c117b
replace golden copyright year
diegomarquezp Jan 3, 2025
90547df
Revert "update valkey to 6.x"
diegomarquezp Jan 3, 2025
1703926
Revert "update project.version in spring-cloud-generator"
diegomarquezp Jan 3, 2025
9b21c9d
Revert "update versions.txt"
diegomarquezp Jan 3, 2025
08efb74
Revert "update project.version in config integrations"
diegomarquezp Jan 3, 2025
95281f2
Revert "update project.version to 6.0.0-SNAPSHOT"
diegomarquezp Jan 3, 2025
23610fd
update secretmanager sample
diegomarquezp Jan 6, 2025
6ce3224
update secret manager to support sm@ and sm:// syntax
diegomarquezp Jan 6, 2025
66a2dca
add parameterized tests for sm:// and sm@ in secretmanager
diegomarquezp Jan 6, 2025
2d9bfbe
adapt secret manager autoconfig tests to new prefix
diegomarquezp Jan 6, 2025
b0dc351
abort full string attempt in secret manager
diegomarquezp Jan 6, 2025
36efaca
consider sm:// when exiting on full string match attempts
diegomarquezp Jan 6, 2025
0ff3b9f
finish sample code
diegomarquezp Jan 6, 2025
c29d726
add functional interface annotation to PrefixMatcher
diegomarquezp Jan 7, 2025
0e2b5d6
make secret manager dependency non-optional in autoconfigure module
diegomarquezp Jan 7, 2025
83d6d02
cleanup
diegomarquezp Jan 7, 2025
6588dfc
fix refresh scope for secretmanager sample
diegomarquezp Jan 7, 2025
acf06f1
update spring-boot to 3.4.2
diegomarquezp Jan 24, 2025
a9cb15a
Merge branch 'main' into test-spring-cloud-2024
diegomarquezp Jan 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 0 additions & 108 deletions .github/workflows/integrationTests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -109,114 +109,6 @@ jobs:
--batch-mode \
--define aggregate=true \
surefire-report:failsafe-report-only
- name: Archive logs
if: always()
continue-on-error: true
uses: actions/upload-artifact@v4
with:
name: Integration Test Logs - ${{ matrix.it}}
path: |
**/target/failsafe-reports/*
**/target/site

spring-boot-3-2-compatibility:
if: |
github.actor != 'dependabot[bot]' && ((
github.event_name == 'pull_request' && github.repository == github.event.pull_request.head.repo.full_name
) || (github.event_name != 'pull_request'))
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
it:
- alloydb
- bigquery
- cloudsql
- config
- datastore
- firestore
- kms
- kotlin
- logging
- metrics
- multisample
- pubsub
- pubsub-bus
- pubsub-docs
- pubsub-emulator
- pubsub-integration
- secretmanager
- spanner
- storage
# trace excluded
- vision
steps:
- name: Get current date
id: date
run: echo "date=$(date +'%Y-%m-%d' --utc)" >> $GITHUB_OUTPUT
- uses: actions/checkout@v2
- name: Setup Java 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17
- name: Set Up Authentication
uses: google-github-actions/auth@v1
with:
credentials_json: ${{ secrets.SPRING_CLOUD_GCP_CI_SA_KEY }}
- name: Setup gcloud
uses: google-github-actions/setup-gcloud@v1
with:
version: latest
project_id: spring-cloud-gcp-ci
export_default_credentials: true
- name: Install pubsub-emulator
if: ${{ matrix.it == 'pubsub-emulator' }}
run: |
gcloud components install pubsub-emulator beta && \
gcloud components update
- name: Mvn install # Need this when the directory/pom structure changes
id: install
run: |
./mvnw \
--batch-mode \
--no-transfer-progress \
--threads 1.5C \
--define maven.test.skip=true \
--define maven.javadoc.skip=true \
--define org.slf4j.simpleLogger.showDateTime=true \
--define org.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss:SSS \
install
- name: Update samples to use Spring Boot Starter 3.2.5
working-directory: ./spring-cloud-gcp-samples
run: |
sudo apt-get update && sudo apt-get install -y xmlstarlet
xmlstarlet ed -L -N x=http://maven.apache.org/POM/4.0.0 \
-u '/x:project/x:parent/x:version' -v '3.2.5' pom.xml
- name: Integration Tests
id: intTest
env:
DB_PASSWORD: ${{ secrets.SPRING_CLOUD_GCP_CI_DB_ROOT_PASSWORD }}
run: |
./mvnw \
--batch-mode \
--no-transfer-progress \
--activate-profiles spring-cloud-gcp-ci-it \
--define maven.javadoc.skip=true \
--define skip.surefire.tests=true \
--define org.slf4j.simpleLogger.showDateTime=true \
--define org.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss:SSS \
--define "spring.datasource.password=${DB_PASSWORD}" \
--define "spring.r2dbc.password=${DB_PASSWORD}" \
--define "spring.cloud.gcp.sql.database-name=code_samples_test_db2" \
--define it.${{ matrix.it }}=true \
verify
- name: Aggregate Report
run: |
./mvnw \
--batch-mode \
--define aggregate=true \
surefire-report:failsafe-report-only
- name: Archive logs
if: always()
continue-on-error: true
Expand Down
6 changes: 6 additions & 0 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ This project has dependency and transitive dependencies on Spring Projects. The
|===
| Spring Framework on Google Cloud | Spring Cloud | Spring Boot | Spring Framework | Supported

|6.x
|https://github.com/spring-cloud/spring-cloud-release/wiki/Spring-Cloud-2024.0-Release-Notes[2024.0.x] (Moorgate)
|https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.4-Release-Notes[3.4.x]
|https://github.com/spring-projects/spring-framework/wiki/Spring-Framework-6.2-Release-Notes[6.2.x]
|Yes

|5.x
|https://github.com/spring-cloud/spring-cloud-release/wiki/Spring-Cloud-2023.0-Release-Notes[2023.0.x] (Leyton)
|https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.2-Release-Notes[3.2.x]*, https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.3-Release-Notes[3.3.x]
Expand Down
2 changes: 2 additions & 0 deletions docs/src/main/asciidoc/getting-started.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ Spring Framework on Google Cloud has dependency and transitive dependencies on S
|===
| Spring Framework on Google Cloud | Spring Cloud | Spring Boot | Spring Framework | Supported


|6.x |https://github.com/spring-cloud/spring-cloud-release/wiki/Spring-Cloud-2024.0-Release-Notes[2024.0.x] (Moorgate)|https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.4-Release-Notes[3.4.x]|https://github.com/spring-projects/spring-framework/wiki/Spring-Framework-6.2-Release-Notes[6.2.x]|Yes
|5.x | https://github.com/spring-cloud/spring-cloud-release/wiki/Spring-Cloud-2023.0-Release-Notes[2023.0.x] (Leyton) |https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.2-Release-Notes[3.2.x]*, https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.3-Release-Notes[3.3.x]
| https://github.com/spring-projects/spring-framework/wiki/What%27s-New-in-Spring-Framework-6.x#whats-new-in-version-61[6.1.x]| Yes
|4.x | https://github.com/spring-cloud/spring-cloud-release/wiki/Spring-Cloud-2022.0-Release-Notes[2022.0.x] (Kilburn) |https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.0-Release-Notes[3.0.x], https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.1-Release-Notes[3.1.x]| https://github.com/spring-projects/spring-framework/wiki/What%27s-New-in-Spring-Framework-6.x#whats-new-in-version-60[6.x]| Yes
Expand Down
65 changes: 65 additions & 0 deletions docs/src/main/asciidoc/migration-guide-5.x.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
== Migration Guide from Spring Cloud GCP 5.x to 6.x
=== Before you start
==== Upgrade to the 5.x version
This doc assumes you are running with Spring Cloud GCP 5.x.

If you are currently running with an earlier major version of Spring Cloud GCP, i.e., 1.x or 2.x, we recommend that you upgrade to [Spring Cloud GCP 5.x] before migrating to Spring Cloud GCP 6.x.

* link:migration-guide-1.x.adoc[Migration guide from Spring Cloud GCP 1.x to 2.x]
* link:migration-guide-3.x.adoc[Migration guide from Spring Cloud GCP 3.x to 4.x]

Note that since Spring Cloud GCP 5.0 has few breaking changes, we have only provided release notes
as reference.

==== Review System requirements
Spring Cloud GCP 6.0 is built on Spring Boot 3.4.x and Spring Framework 6.2.x, which requires Java 17 at minimum.
If you are currently on Java 8 or Java 11, you need to upgrade your JDK before you can develop an application based on Spring Cloud GCP 6.0.

=== Upgrade to Spring Cloud GCP 6.0
==== Update Bill of Materials (BOM)
If you’re a Maven user, add our BOM to your pom.xml `<dependencyManagement>` section.
This will allow you to not specify versions for any of the Maven dependencies and instead delegate versioning to the BOM.

[source, xml]
----
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>spring-cloud-gcp-dependencies</artifactId>
<version>6.0.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
----

===== Review Dependencies
Run `mvn dependency:tree` (`gradlew dependencies` for Gradle projects) to see the dependency tree of your project.
Ensure Spring-related dependencies have matching versions:

* Spring Boot 3.4.x
* Spring Cloud 2024.x
** For detailed dependency versions, see "2024.0 (Moorgate)" column in link:https://github.com/spring-cloud/spring-cloud-release/wiki/Supported-Versions#supported-releases[Spring Cloud: Supported Versions] table.

==== Secret Manager
Introduced support for the `${sm@secret_id}` syntax. This new syntax is encouraged over the (still
supported) `${sm://secret_id}` syntax. Users still relying on the `sm://` syntax will be issued a
warning.

For example:
[source, java]
@Value("${sm@my_secret}")
String mySecret;
---

==== Datastore
Introduced support for `ValueExpressionDelegate`. This class is suggested over
`QueryMethodEvaluationContextProvider`.

==== Spanner
Introduced support for `ValueExpressionDelegate`. This class is suggested over
`QueryMethodEvaluationContextProvider`.


4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
<properties>
<project.parent.version>${project.version}</project.parent.version>
<!-- Dependency versions -->
<spring-cloud-dependencies.version>2023.0.3</spring-cloud-dependencies.version>
<spring-boot-dependencies.version>3.3.4</spring-boot-dependencies.version>
<spring-cloud-dependencies.version>2024.0.0</spring-cloud-dependencies.version>
<spring-boot-dependencies.version>3.4.1</spring-boot-dependencies.version>
burkedavison marked this conversation as resolved.
Show resolved Hide resolved
<spring-cloud-gcp-dependencies.version>${project.parent.version}</spring-cloud-gcp-dependencies.version>
<zipkin-gcp.version>2.2.5</zipkin-gcp.version>
<java-cfenv.version>2.5.0</java-cfenv.version>
Expand Down
5 changes: 4 additions & 1 deletion spring-cloud-gcp-autoconfigure/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,10 @@
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>spring-cloud-gcp-secretmanager</artifactId>
<optional>true</optional>
<!-- A few starters need this dependency to validate secrets -->
<!-- using SecretManagerSyntaxUtils. Making it optional produces runtime failures -->
<!-- of the kind ClassNotFoundError. -->
<optional>false</optional>
</dependency>

<!-- KMS -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@

package com.google.cloud.spring.autoconfigure.secretmanager;

import static com.google.cloud.spring.secretmanager.SecretManagerSyntaxUtils.getMatchedPrefixes;
import static com.google.cloud.spring.secretmanager.SecretManagerSyntaxUtils.warnIfUsingDeprecatedSyntax;

import com.google.cloud.secretmanager.v1.SecretManagerServiceClient;
import com.google.cloud.secretmanager.v1.SecretManagerServiceSettings;
import com.google.cloud.spring.core.DefaultCredentialsProvider;
Expand All @@ -26,7 +29,10 @@
import java.io.IOException;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import org.apache.arrow.util.VisibleForTesting;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.boot.BootstrapRegistry;
import org.springframework.boot.context.config.ConfigDataLocation;
Expand All @@ -38,10 +44,8 @@
public class SecretManagerConfigDataLocationResolver implements
ConfigDataLocationResolver<SecretManagerConfigDataResource> {

/**
* ConfigData Prefix for Google Cloud Secret Manager.
*/
public static final String PREFIX = "sm://";
private static final Logger logger = LoggerFactory.getLogger(SecretManagerConfigDataLocationResolver.class);

/**
* A static client to avoid creating another client after refreshing.
*/
Expand All @@ -50,7 +54,9 @@ public class SecretManagerConfigDataLocationResolver implements
@Override
public boolean isResolvable(ConfigDataLocationResolverContext context,
ConfigDataLocation location) {
return location.hasPrefix(PREFIX);
Optional<String> matchedPrefix = getMatchedPrefixes(location::hasPrefix);
warnIfUsingDeprecatedSyntax(logger, matchedPrefix.orElse(""));
return matchedPrefix.isPresent();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@
import com.google.cloud.secretmanager.v1.SecretPayload;
import com.google.cloud.secretmanager.v1.SecretVersionName;
import com.google.protobuf.ByteString;
import java.util.stream.Stream;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
import org.springframework.boot.BootstrapRegistry.InstanceSupplier;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.builder.SpringApplicationBuilder;
Expand All @@ -28,6 +32,13 @@ class SecretManagerCompatibilityTests {
private SpringApplicationBuilder application;
private SecretManagerServiceClient client;

static Stream<Arguments> prefixes() {
return Stream.of(
Arguments.of("sm://"),
Arguments.of("sm@")
);
}

@BeforeEach
void init() {
application = new SpringApplicationBuilder(SecretManagerCompatibilityTests.class)
Expand Down Expand Up @@ -64,10 +75,11 @@ void init() {
* com.google.cloud.spring.secretmanager.SecretManagerTemplate} autoconfiguration and properties
* resolved.
*/
@Test
void testConfigurationWhenDefaultSecretIsNotAllowed() {
@ParameterizedTest
@MethodSource("prefixes")
void testConfigurationWhenDefaultSecretIsNotAllowed(String prefix) {
application.properties(
"spring.config.import=sm://")
"spring.config.import=" + prefix)
.addBootstrapRegistryInitializer(
(registry) -> registry.registerIfAbsent(
SecretManagerServiceClient.class,
Expand All @@ -76,17 +88,18 @@ void testConfigurationWhenDefaultSecretIsNotAllowed() {
);
try (ConfigurableApplicationContext applicationContext = application.run()) {
ConfigurableEnvironment environment = applicationContext.getEnvironment();
assertThat(environment.getProperty("sm://my-secret")).isEqualTo("newSecret");
assertThatThrownBy(() -> environment.getProperty("sm://fake-secret"))
assertThat(environment.getProperty(prefix + "my-secret")).isEqualTo("newSecret");
assertThatThrownBy(() -> environment.getProperty(prefix + "fake-secret"))
.isExactlyInstanceOf(NotFoundException.class);
}
}

@Test
void testConfigurationWhenDefaultSecretIsAllowed() {
@ParameterizedTest
@MethodSource("prefixes")
void testConfigurationWhenDefaultSecretIsAllowed(String prefix) {
application.properties(
"spring.cloud.gcp.secretmanager.allow-default-secret=true",
"spring.config.import=sm://")
"spring.config.import=" + prefix)
.addBootstrapRegistryInitializer(
(registry) -> registry.registerIfAbsent(
SecretManagerServiceClient.class,
Expand All @@ -95,8 +108,8 @@ void testConfigurationWhenDefaultSecretIsAllowed() {
);
try (ConfigurableApplicationContext applicationContext = application.run()) {
ConfigurableEnvironment environment = applicationContext.getEnvironment();
assertThat(environment.getProperty("sm://my-secret")).isEqualTo("newSecret");
assertThat(environment.getProperty("sm://fake-secret")).isNull();
assertThat(environment.getProperty(prefix + "my-secret")).isEqualTo("newSecret");
assertThat(environment.getProperty(prefix + "fake-secret")).isNull();
}
}
}
Loading
Loading