Merge branch '3.1.x'

This commit is contained in:
Ryan Baxter
2022-07-14 15:37:21 -04:00
6 changed files with 54 additions and 74 deletions

View File

@@ -19,6 +19,8 @@
<docs.main>spring-cloud-config</docs.main>
<main.basedir>${basedir}/..</main.basedir>
<upload-docs-zip.phase>deploy</upload-docs-zip.phase>
<!-- Don't upload docs jar to central / repo.spring.io -->
<maven-deploy-plugin-default.phase>none</maven-deploy-plugin-default.phase>
<configprops.inclusionPattern>spring.cloud.config.*</configprops.inclusionPattern>
<!-- Observability -->

37
pom.xml
View File

@@ -73,11 +73,24 @@
<version>${spring-cloud-commons.version}</version>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>bom</artifactId>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-core</artifactId>
<version>${aws-java-sdk.version}</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-s3</artifactId>
<version>${aws-java-sdk.version}</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-secretsmanager</artifactId>
<version>${aws-java-sdk.version}</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-ssm</artifactId>
<version>${aws-java-sdk.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.google.apis</groupId>
@@ -105,21 +118,7 @@
<version>${testcontainers.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-bom</artifactId>
<version>${micrometer.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-tracing-bom</artifactId>
<version>${micrometer-tracing.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependency>
<dependency>
<groupId>com.github.tomakehurst</groupId>
<artifactId>wiremock-jre8</artifactId>

View File

@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>spring-cloud-config-client-tls-tests</artifactId>
<packaging>jar</packaging>
@@ -86,11 +87,7 @@
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-test-support</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>

View File

@@ -98,28 +98,23 @@
<optional>true</optional>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>auth</artifactId>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-core</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>s3</artifactId>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-s3</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>aws-core</artifactId>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-secretsmanager</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>secretsmanager</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>ssm</artifactId>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-ssm</artifactId>
<optional>true</optional>
</dependency>
<dependency>
@@ -182,41 +177,6 @@
<artifactId>wiremock-jre8</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-observation-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-tracing-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-tracing-bridge-brave</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.zipkin.brave</groupId>
<artifactId>brave-tests</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.zipkin.reporter2</groupId>
<artifactId>zipkin-reporter-brave</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.zipkin.reporter2</groupId>
<artifactId>zipkin-sender-urlconnection</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<properties>

View File

@@ -34,6 +34,7 @@ import software.amazon.awssdk.services.ssm.model.Parameter;
import org.springframework.cloud.config.environment.Environment;
import org.springframework.cloud.config.environment.PropertySource;
import org.springframework.cloud.config.server.config.ConfigServerProperties;
import org.springframework.core.Ordered;
import org.springframework.util.StringUtils;
import static org.springframework.cloud.config.server.environment.AwsParameterStoreEnvironmentProperties.DEFAULT_PATH_SEPARATOR;
@@ -41,7 +42,7 @@ import static org.springframework.cloud.config.server.environment.AwsParameterSt
/**
* @author Iulian Antohe
*/
public class AwsParameterStoreEnvironmentRepository implements EnvironmentRepository {
public class AwsParameterStoreEnvironmentRepository implements EnvironmentRepository, Ordered {
private final SsmClient awsSsmClient;
@@ -49,11 +50,14 @@ public class AwsParameterStoreEnvironmentRepository implements EnvironmentReposi
private final AwsParameterStoreEnvironmentProperties environmentProperties;
private final int order;
public AwsParameterStoreEnvironmentRepository(SsmClient awsSsmClient, ConfigServerProperties configServerProperties,
AwsParameterStoreEnvironmentProperties environmentProperties) {
this.awsSsmClient = awsSsmClient;
this.configServerProperties = configServerProperties;
this.environmentProperties = environmentProperties;
this.order = environmentProperties.getOrder();
}
@Override
@@ -164,4 +168,9 @@ public class AwsParameterStoreEnvironmentRepository implements EnvironmentReposi
}
}
@Override
public int getOrder() {
return order;
}
}

View File

@@ -40,6 +40,7 @@ import software.amazon.awssdk.services.ssm.model.ParameterType;
import org.springframework.cloud.config.environment.Environment;
import org.springframework.cloud.config.environment.PropertySource;
import org.springframework.cloud.config.server.config.ConfigServerProperties;
import org.springframework.core.Ordered;
import org.springframework.util.StringUtils;
import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic;
@@ -800,4 +801,16 @@ public class AwsParameterStoreEnvironmentRepositoryTests {
return Base64.getEncoder().encodeToString(random.getBytes(StandardCharsets.UTF_8));
}
@Test
public void testOrderPopulation() {
int expectedOrder = Ordered.HIGHEST_PRECEDENCE;
AwsParameterStoreEnvironmentRepositoryFactory factory = new AwsParameterStoreEnvironmentRepositoryFactory(
new ConfigServerProperties());
AwsParameterStoreEnvironmentProperties properties = new AwsParameterStoreEnvironmentProperties();
properties.setOrder(expectedOrder);
AwsParameterStoreEnvironmentRepository repository = factory.build(properties);
int actualOrder = repository.getOrder();
assertThat(actualOrder).isEqualTo(expectedOrder);
}
}