GoogleCloudPlatform / GoogleCloudPlatform/spring-cloud-gcp
Add support for Service Connections with Spring Boot 3.1
- Dominant language
- Java
- Stars
- 551
- Forks
- 349
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 14
Description
**Is your feature request related to a problem? Please describe.**
Spring Boot 3.1 introduces [Service Connections](https://docs.spring.io/spring-boot/docs/3.1.0-RC1/reference/htmlsingle/#features.testing.testcontainers.service-connections) which can be used with Testcontainers in order to reduce the boilerplate code to setup Datastore, Firestore, PubSub, Spanner for testing
From:
```java
@Container
private static final SpannerEmulatorContainer spannerEmulator =
new SpannerEmulatorContainer(
DockerImageName.parse("gcr.io/cloud-spanner-emulator/emulator:1.1.1"));
@DynamicPropertySource
static void emulatorProperties(DynamicPropertyRegistry registry) {
registry.add(
"spring.cloud.gcp.spanner.emulator-host", spannerEmulator::getEmulatorGrpcEndpoint);
}
```
To:
```java
@Container
@ServiceConnection
private static final SpannerEmulatorContainer spannerEmulator =
new SpannerEmulatorContainer(
DockerImageName.parse("gcr.io/cloud-spanner-emulator/emulator:1.1.1"));
```
There is also benefits about using it at [development time](https://docs.spring.io/spring-boot/docs/3.1.0-RC1/reference/htmlsingle/#features.testing.testcontainers.at-development-time).
**Describe the solution you'd like**
Provide support for Service Connections for Datastore, Firestore, PubSub and Spanner
**Describe alternatives you've considered**
Still using the same approach or implement my own.
**Additional context**
[Here](https://github.com/spring-projects/spring-boot/pull/35082/files) you can see what is needed in order to make this happen. I've already contributed to spring boot and also to spring-cloud-gcp. So, I would be glad to contribute if this is accepted.
Contributor guide
Research direction
Start with the Spring Boot Service Connections documentation and the referenced Spring Boot PR to understand the integration points. Then inspect the existing Datastore, Firestore, PubSub, and Spanner support and their tests. Done means Service Connections work for all four services, including the development-time use case described in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- google-cloud, java, spring-boot
- Domain
- cloud
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100