Skip to content

Commit 1996889

Browse files
authored
Add Storage Blob and Queue Service Connection from Docker Compose (#41321)
1 parent bf88843 commit 1996889

16 files changed

Lines changed: 425 additions & 3 deletions

File tree

eng/versioning/external_dependencies.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# make sure the version is same to sdk/spring/scripts/spring_boot_2.7.18_managed_external_dependencies.txt
33
# If your version is different from sdk/spring/scripts/spring_boot_2.7.18_managed_external_dependencies.txt,
44
# please discuss with Spring Integration team members:
5-
# @rujche (rujche), @saragluna (xiada), @yiliuTo (yiliu6), @backwind1233 (zhihaoguo).
5+
# @rujche (rujche), @saragluna (xiada).
66
# Thanks.
77

88
# Format;
@@ -505,6 +505,7 @@ springboot3_org.springframework.boot:spring-boot-autoconfigure;3.3.3
505505
springboot3_org.springframework.boot:spring-boot-configuration-metadata;3.3.3
506506
springboot3_org.springframework.boot:spring-boot-configuration-processor;3.3.3
507507
springboot3_org.springframework.boot:spring-boot-dependencies;3.3.3
508+
springboot3_org.springframework.boot:spring-boot-docker-compose;3.3.3
508509
springboot3_org.springframework.boot:spring-boot-starter-actuator;3.3.3
509510
springboot3_org.springframework.boot:spring-boot-starter-integration;3.3.3
510511
springboot3_org.springframework.boot:spring-boot-starter-parent;3.3.3

eng/versioning/version_client.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ com.azure.spring:spring-cloud-azure-core;5.15.0;5.16.0-beta.1
228228
com.azure.spring:spring-cloud-azure-actuator-autoconfigure;5.15.0;5.16.0-beta.1
229229
com.azure.spring:spring-cloud-azure-actuator;5.15.0;5.16.0-beta.1
230230
com.azure.spring:spring-cloud-azure-autoconfigure;5.15.0;5.16.0-beta.1
231+
com.azure.spring:spring-cloud-azure-docker-compose;5.16.0-beta.1;5.16.0-beta.1
231232
com.azure.spring:spring-cloud-azure-resourcemanager;5.15.0;5.16.0-beta.1
232233
com.azure.spring:spring-cloud-azure-service;5.15.0;5.16.0-beta.1
233234
com.azure.spring:spring-cloud-azure-starter-active-directory;5.15.0;5.16.0-beta.1

sdk/boms/spring-cloud-azure-dependencies/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,11 @@
321321
<artifactId>spring-cloud-azure-starter-jdbc-postgresql</artifactId>
322322
<version>${project.version}</version>
323323
</dependency>
324+
<dependency>
325+
<groupId>com.azure.spring</groupId>
326+
<artifactId>spring-cloud-azure-docker-compose</artifactId>
327+
<version>${project.version}</version>
328+
</dependency>
324329
<dependency>
325330
<groupId>com.azure.spring</groupId>
326331
<artifactId>spring-cloud-azure-testcontainers</artifactId>

sdk/spring/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ This section includes changes in `spring-cloud-azure-autoconfigure` module.
2020
#### Dependency Updates
2121
- Upgrade `azure-sdk-bom` to 1.2.26.
2222
- Added a new dependency: `spring-cloud-azure-testcontainers`.
23+
- Added a new dependency: `spring-cloud-azure-docker-compose`.
2324

2425
### Spring Cloud Azure Autoconfigure
2526
This section includes changes in `spring-cloud-azure-autoconfigure` module.

sdk/spring/pom.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
<module>spring-cloud-azure-starter-jdbc-mysql</module>
6161
<module>spring-cloud-azure-starter-jdbc-postgresql</module>
6262
<module>spring-cloud-azure-testcontainers</module>
63+
<module>spring-cloud-azure-docker-compose</module>
6364
<module>spring-cloud-azure-integration-tests</module>
6465
<module>spring-cloud-azure-integration-test-appconfiguration-config</module>
6566
<module>spring-cloud-azure-appconfiguration-config</module>
@@ -123,6 +124,7 @@
123124
<module>spring-cloud-azure-starter-jdbc-mysql</module>
124125
<module>spring-cloud-azure-starter-jdbc-postgresql</module>
125126
<module>spring-cloud-azure-testcontainers</module>
127+
<module>spring-cloud-azure-docker-compose</module>
126128
<module>spring-cloud-azure-integration-test-appconfiguration-config</module>
127129
<module>spring-cloud-azure-appconfiguration-config</module>
128130
<module>spring-cloud-azure-appconfiguration-config-web</module>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Release History
2+
3+
## 5.15.0-beta.1 (Unreleased)
4+
5+
### Features Added
6+
7+
### Breaking Changes
8+
9+
### Bugs Fixed
10+
11+
### Other Changes

sdk/spring/spring-cloud-azure-docker-compose/README.md

Whitespace-only changes.
Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<parent>
6+
<groupId>com.azure</groupId>
7+
<artifactId>azure-client-sdk-parent</artifactId>
8+
<version>1.7.0</version> <!-- {x-version-update;com.azure:azure-client-sdk-parent;current} -->
9+
<relativePath>../../parents/azure-client-sdk-parent</relativePath>
10+
</parent>
11+
<modelVersion>4.0.0</modelVersion>
12+
13+
<groupId>com.azure.spring</groupId>
14+
<artifactId>spring-cloud-azure-docker-compose</artifactId>
15+
<version>5.16.0-beta.1</version> <!-- {x-version-update;com.azure.spring:spring-cloud-azure-docker-compose;current} -->
16+
17+
<name>Spring Cloud Azure Docker Compose</name>
18+
<description>Spring Cloud Azure Docker Compose</description>
19+
<url>https://microsoft.github.io/spring-cloud-azure</url>
20+
<developers>
21+
<developer>
22+
<name>Spring Cloud Azure</name>
23+
<email>SpringIntegSupport@microsoft.com</email>
24+
</developer>
25+
</developers>
26+
<scm>
27+
<connection>scm:git:git@github.com:Azure/azure-sdk-for-java.git</connection>
28+
<developerConnection>scm:git:ssh://git@github.com:Azure/azure-sdk-for-java.git</developerConnection>
29+
<url>https://github.com/Azure/azure-sdk-for-java</url>
30+
</scm>
31+
<issueManagement>
32+
<system>GitHub</system>
33+
<url>https://github.com/Azure/azure-sdk-for-java/issues</url>
34+
</issueManagement>
35+
<properties>
36+
<!-- Enables fail on deprecated API usage. -->
37+
<compiler.failondeprecatedstatus/>
38+
<jacoco.skip>true</jacoco.skip>
39+
</properties>
40+
<dependencies>
41+
<dependency>
42+
<groupId>com.azure.spring</groupId>
43+
<artifactId>spring-cloud-azure-autoconfigure</artifactId>
44+
<version>5.16.0-beta.1</version> <!-- {x-version-update;com.azure.spring:spring-cloud-azure-autoconfigure;current} -->
45+
<optional>true</optional>
46+
</dependency>
47+
<dependency>
48+
<groupId>com.azure</groupId>
49+
<artifactId>azure-storage-blob</artifactId>
50+
<version>12.27.1</version> <!-- {x-version-update;com.azure:azure-storage-blob;dependency} -->
51+
<optional>true</optional>
52+
</dependency>
53+
<dependency>
54+
<groupId>com.azure</groupId>
55+
<artifactId>azure-storage-queue</artifactId>
56+
<version>12.22.1</version> <!-- {x-version-update;com.azure:azure-storage-queue;dependency} -->
57+
<optional>true</optional>
58+
</dependency>
59+
60+
<dependency>
61+
<groupId>org.springframework.boot</groupId>
62+
<artifactId>spring-boot-docker-compose</artifactId>
63+
<version>3.3.3</version> <!-- {x-version-update;springboot3_org.springframework.boot:spring-boot-docker-compose;external_dependency} -->
64+
</dependency>
65+
<!-- Added this dependency to include necessary annotations used by reactor core.
66+
Without this dependency, javadoc throws a warning as it cannot find enum When.MAYBE
67+
which is used in @Nullable annotation in reactor core classes -->
68+
<dependency>
69+
<groupId>com.google.code.findbugs</groupId>
70+
<artifactId>jsr305</artifactId>
71+
<version>3.0.2</version> <!-- {x-version-update;springboot3_com.google.code.findbugs:jsr305;external_dependency} -->
72+
<scope>provided</scope>
73+
</dependency>
74+
75+
<dependency>
76+
<groupId>org.springframework.boot</groupId>
77+
<artifactId>spring-boot-test</artifactId>
78+
<version>3.3.3</version> <!-- {x-version-update;springboot3_org.springframework.boot:spring-boot-test;external_dependency} -->
79+
<scope>test</scope>
80+
</dependency>
81+
<dependency>
82+
<groupId>org.springframework</groupId>
83+
<artifactId>spring-test</artifactId>
84+
<version>6.1.12</version> <!-- {x-version-update;springboot3_org.springframework:spring-test;external_dependency} -->
85+
<scope>test</scope>
86+
</dependency>
87+
<dependency>
88+
<groupId>org.junit.jupiter</groupId>
89+
<artifactId>junit-jupiter</artifactId>
90+
<version>5.10.3</version> <!-- {x-version-update;springboot3_org.junit.jupiter:junit-jupiter;external_dependency} -->
91+
<scope>test</scope>
92+
</dependency>
93+
<dependency>
94+
<groupId>org.assertj</groupId>
95+
<artifactId>assertj-core</artifactId>
96+
<version>3.25.3</version> <!-- {x-version-update;springboot3_org.assertj:assertj-core;external_dependency} -->
97+
<scope>test</scope>
98+
</dependency>
99+
</dependencies>
100+
101+
<build>
102+
<plugins>
103+
<plugin>
104+
<groupId>com.github.spotbugs</groupId>
105+
<artifactId>spotbugs-maven-plugin</artifactId>
106+
<version>4.8.2.0</version> <!-- {x-version-update;springboot3_com.github.spotbugs:spotbugs-maven-plugin;external_dependency} -->
107+
<configuration>
108+
<skip>true</skip>
109+
</configuration>
110+
</plugin>
111+
<plugin>
112+
<groupId>com.diffplug.spotless</groupId>
113+
<artifactId>spotless-maven-plugin</artifactId>
114+
<version>2.30.0</version> <!-- {x-version-update;springboot3_com.diffplug.spotless:spotless-maven-plugin;external_dependency} -->
115+
<configuration>
116+
<skip>true</skip>
117+
</configuration>
118+
</plugin>
119+
<plugin>
120+
<groupId>org.revapi</groupId>
121+
<artifactId>revapi-maven-plugin</artifactId>
122+
<version>0.14.6</version> <!-- {x-version-update;springboot3_org.revapi:revapi-maven-plugin;external_dependency} -->
123+
<configuration>
124+
<skip>true</skip>
125+
</configuration>
126+
</plugin>
127+
<plugin>
128+
<groupId>com.azure.tools</groupId>
129+
<artifactId>codesnippet-maven-plugin</artifactId>
130+
<version>1.0.0-beta.10</version> <!-- {x-version-update;com.azure.tools:codesnippet-maven-plugin;external_dependency} -->
131+
<configuration>
132+
<skip>true</skip>
133+
</configuration>
134+
</plugin>
135+
<plugin>
136+
<groupId>org.apache.maven.plugins</groupId>
137+
<artifactId>maven-compiler-plugin</artifactId>
138+
<version>3.13.0</version> <!-- {x-version-update;springboot3_org.apache.maven.plugins:maven-compiler-plugin;external_dependency} -->
139+
<executions>
140+
<!-- disabled - the executing this after default-compile will generate module-info with major class version 55 (i.e Java 11) -->
141+
<execution>
142+
<id>base-modules-compile</id>
143+
<phase>none</phase>
144+
</execution>
145+
<!-- disabled - compile without module-info for Java 8 -->
146+
<execution>
147+
<id>base-compile</id>
148+
<phase>none</phase>
149+
</execution>
150+
<!-- disabled - compile with Java 8 -->
151+
<execution>
152+
<id>base-testCompile</id>
153+
<phase>none</phase>
154+
</execution>
155+
<!-- Ensure we compile with Java 17 -->
156+
<execution>
157+
<goals>
158+
<goal>compile</goal>
159+
</goals>
160+
<configuration>
161+
<release>17</release>
162+
</configuration>
163+
</execution>
164+
</executions>
165+
</plugin>
166+
<plugin>
167+
<groupId>org.apache.maven.plugins</groupId>
168+
<artifactId>maven-enforcer-plugin</artifactId>
169+
<version>3.4.1</version> <!-- {x-version-update;springboot3_org.apache.maven.plugins:maven-enforcer-plugin;external_dependency} -->
170+
<configuration>
171+
<rules>
172+
<bannedDependencies>
173+
<includes>
174+
<include>org.springframework.boot:spring-boot-docker-compose:[3.3.3]</include> <!-- {x-include-update;springboot3_org.springframework.boot:spring-boot-docker-compose;external_dependency} -->
175+
</includes>
176+
</bannedDependencies>
177+
</rules>
178+
</configuration>
179+
</plugin>
180+
<plugin>
181+
<groupId>org.apache.maven.plugins</groupId>
182+
<artifactId>maven-jar-plugin</artifactId>
183+
<version>3.4.2</version> <!-- {x-version-update;springboot3_org.apache.maven.plugins:maven-jar-plugin;external_dependency} -->
184+
<configuration>
185+
<archive>
186+
<manifestEntries>
187+
<Automatic-Module-Name>com.azure.spring.cloud.docker.compose</Automatic-Module-Name>
188+
</manifestEntries>
189+
</archive>
190+
</configuration>
191+
</plugin>
192+
</plugins>
193+
</build>
194+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
package com.azure.spring.cloud.docker.compose.implementation.service.connection.storage;
5+
6+
import com.azure.spring.cloud.autoconfigure.implementation.storage.blob.properties.AzureStorageBlobConnectionDetails;
7+
import org.springframework.boot.docker.compose.core.RunningService;
8+
import org.springframework.boot.docker.compose.service.connection.DockerComposeConnectionDetailsFactory;
9+
import org.springframework.boot.docker.compose.service.connection.DockerComposeConnectionSource;
10+
11+
class StorageBlobDockerComposeConnectionDetailsFactory
12+
extends DockerComposeConnectionDetailsFactory<AzureStorageBlobConnectionDetails> {
13+
14+
private static final int STORAGE_BLOB_PORT = 10_000;
15+
16+
protected StorageBlobDockerComposeConnectionDetailsFactory() {
17+
super("azure-storage/azurite");
18+
}
19+
20+
@Override
21+
protected AzureStorageBlobConnectionDetails getDockerComposeConnectionDetails(DockerComposeConnectionSource source) {
22+
return new StorageBlobContainerConnectionDetails(source.getRunningService());
23+
}
24+
25+
/**
26+
* {@link AzureStorageBlobConnectionDetails} backed by a {@code Storage Blob}
27+
* {@link RunningService}.
28+
*/
29+
private static class StorageBlobContainerConnectionDetails extends DockerComposeConnectionDetails
30+
implements AzureStorageBlobConnectionDetails {
31+
32+
private final String host;
33+
34+
private final int port;
35+
36+
StorageBlobContainerConnectionDetails(RunningService service) {
37+
super(service);
38+
this.host = service.host();
39+
this.port = service.ports().get(STORAGE_BLOB_PORT);
40+
}
41+
42+
@Override
43+
public String getConnectionString() {
44+
return "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://%s:%d/devstoreaccount1;"
45+
.formatted(this.host, this.port);
46+
}
47+
}
48+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
package com.azure.spring.cloud.docker.compose.implementation.service.connection.storage;
5+
6+
import com.azure.spring.cloud.autoconfigure.implementation.storage.blob.properties.AzureStorageBlobConnectionDetails;
7+
import com.azure.spring.cloud.autoconfigure.implementation.storage.queue.properties.AzureStorageQueueConnectionDetails;
8+
import org.springframework.boot.docker.compose.core.RunningService;
9+
import org.springframework.boot.docker.compose.service.connection.DockerComposeConnectionDetailsFactory;
10+
import org.springframework.boot.docker.compose.service.connection.DockerComposeConnectionSource;
11+
12+
class StorageQueueDockerComposeConnectionDetailsFactory
13+
extends DockerComposeConnectionDetailsFactory<AzureStorageQueueConnectionDetails> {
14+
15+
private static final int STORAGE_QUEUE_PORT = 10_001;
16+
17+
protected StorageQueueDockerComposeConnectionDetailsFactory() {
18+
super("azure-storage/azurite");
19+
}
20+
21+
@Override
22+
protected AzureStorageQueueConnectionDetails getDockerComposeConnectionDetails(DockerComposeConnectionSource source) {
23+
return new StorageQueueContainerConnectionDetails(source.getRunningService());
24+
}
25+
26+
/**
27+
* {@link AzureStorageBlobConnectionDetails} backed by a {@code Storage Queue}
28+
* {@link RunningService}.
29+
*/
30+
private static class StorageQueueContainerConnectionDetails extends DockerComposeConnectionDetails
31+
implements AzureStorageQueueConnectionDetails {
32+
33+
private final String host;
34+
35+
private final int port;
36+
37+
StorageQueueContainerConnectionDetails(RunningService service) {
38+
super(service);
39+
this.host = service.host();
40+
this.port = service.ports().get(STORAGE_QUEUE_PORT);
41+
}
42+
43+
@Override
44+
public String getConnectionString() {
45+
return "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;QueueEndpoint=http://%s:%d/devstoreaccount1;"
46+
.formatted(this.host, this.port);
47+
}
48+
49+
@Override
50+
public String getEndpoint() {
51+
return "http://%s:%d".formatted(this.host, this.port);
52+
}
53+
}
54+
}

0 commit comments

Comments
 (0)