Skip to content

Commit 61c9aec

Browse files
committed
Merge branch 'main' into move-to-a-common-configuration-for-health
2 parents d2504b6 + ed2080b commit 61c9aec

File tree

54 files changed

+927
-1402
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+927
-1402
lines changed

docs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"dependencies": {
33
"antora": "3.2.0-alpha.4",
44
"@antora/atlas-extension": "1.0.0-alpha.2",
5-
"@antora/collector-extension": "1.0.0-alpha.3",
5+
"@antora/collector-extension": "1.0.0-beta.3",
66
"@asciidoctor/tabs": "1.0.0-beta.6",
77
"@springio/antora-extensions": "1.11.1",
88
"@springio/asciidoctor-extensions": "1.0.0-alpha.14"

pom.xml

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2020
xmlns="http://maven.apache.org/POM/4.0.0"
2121
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
22-
22+
2323
<modelVersion>4.0.0</modelVersion>
2424

2525
<parent>
@@ -155,19 +155,6 @@
155155
<scope>import</scope>
156156
</dependency>
157157

158-
<!--Spring Boot 3.1 uses Mockito 5.x. Mockito 5.x has removed support for mockito-inline.-->
159-
<!--https://github.com/mockito/mockito/issues/2877-->
160-
<!--We need to support both Boot 3.0.x and Boot 3.1.x with Spring Cloud K8s 3.0.x-->
161-
<!--To maintain compatibility we manage the version ourselves-->
162-
<!-- TODO Remove this and all references to mockito-inline in the next minor -->
163-
<dependency>
164-
<groupId>org.mockito</groupId>
165-
<artifactId>mockito-bom</artifactId>
166-
<version>${mockito-inline.version}</version>
167-
<type>pom</type>
168-
<scope>import</scope>
169-
</dependency>
170-
171158
<dependency>
172159
<groupId>org.codehaus.groovy</groupId>
173160
<artifactId>groovy-all</artifactId>

scripts/integration-tests.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
#!/usr/bin/env bash
22
set -e
33

4-
rm ~/.testcontainers.properties
4+
if [ -f "~/.testcontainers.properties" ]; then
5+
rm ~/.testcontainers.properties
6+
fi
57
echo 'testcontainers.reuse.enable=true' > ~/.testcontainers.properties
68

79
./mvnw clean install -B -Pdocs ${@}

spring-cloud-kubernetes-client-autoconfig/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
</dependency>
5252
<dependency>
5353
<groupId>org.mockito</groupId>
54-
<artifactId>mockito-inline</artifactId>
54+
<artifactId>mockito-core</artifactId>
5555
<scope>test</scope>
5656
</dependency>
5757
<dependency>

spring-cloud-kubernetes-client-config/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@
106106
</dependency>
107107
<dependency>
108108
<groupId>org.mockito</groupId>
109-
<artifactId>mockito-inline</artifactId>
109+
<artifactId>mockito-core</artifactId>
110110
<scope>test</scope>
111111
</dependency>
112112
<dependency>

spring-cloud-kubernetes-client-loadbalancer/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545

4646
<dependency>
4747
<groupId>org.mockito</groupId>
48-
<artifactId>mockito-inline</artifactId>
48+
<artifactId>mockito-core</artifactId>
4949
<scope>test</scope>
5050
</dependency>
5151

spring-cloud-kubernetes-commons/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@
9999
</dependency>
100100
<dependency>
101101
<groupId>org.mockito</groupId>
102-
<artifactId>mockito-inline</artifactId>
102+
<artifactId>mockito-core</artifactId>
103103
<scope>test</scope>
104104
</dependency>
105105
<dependency>

spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/config/ConfigMapPropertySourceLocator.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import java.util.Collection;
2323
import java.util.HashMap;
2424
import java.util.LinkedHashSet;
25+
import java.util.Locale;
2526
import java.util.Map;
2627
import java.util.Set;
2728
import java.util.function.Function;
@@ -120,7 +121,7 @@ private void addPropertySourcesFromPaths(Environment environment, CompositePrope
120121
}).toList().forEach(p -> {
121122
try {
122123
String content = new String(Files.readAllBytes(p)).trim();
123-
String filename = p.toAbsolutePath().toString().toLowerCase();
124+
String filename = p.toAbsolutePath().toString().toLowerCase(Locale.ROOT);
124125
if (filename.endsWith(".properties")) {
125126
addPropertySourceIfNeeded(c -> PROPERTIES_TO_MAP.apply(KEY_VALUE_TO_PROPERTIES.apply(c)), content,
126127
filename, composite);

spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/config/ConfigUtils.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636

3737
import org.springframework.boot.BootstrapRegistry;
3838
import org.springframework.boot.ConfigurableBootstrapContext;
39+
import org.springframework.context.ApplicationListener;
3940
import org.springframework.core.env.Environment;
4041
import org.springframework.core.style.ToStringCreator;
4142
import org.springframework.util.CollectionUtils;
@@ -60,6 +61,8 @@ public final class ConfigUtils {
6061
|| sourceName.endsWith("-" + activeProfile + ".yaml")
6162
|| sourceName.endsWith("-" + activeProfile + ".properties");
6263

64+
private static final ApplicationListener<?> NO_OP = (e) -> { };
65+
6366
private ConfigUtils() {
6467
}
6568

@@ -329,17 +332,23 @@ private static Map<String, String> decodeData(Map<String, String> data) {
329332
}
330333

331334
public static <T> void registerSingle(ConfigurableBootstrapContext bootstrapContext, Class<T> cls, T instance,
332-
String name) {
335+
String name, ApplicationListener<?> listener) {
333336
bootstrapContext.registerIfAbsent(cls, BootstrapRegistry.InstanceSupplier.of(instance));
334337
bootstrapContext.addCloseListener(event -> {
335338
if (event.getApplicationContext().getBeanFactory().getSingleton(name) == null) {
336339
event.getApplicationContext()
337340
.getBeanFactory()
338341
.registerSingleton(name, event.getBootstrapContext().get(cls));
342+
event.getApplicationContext().addApplicationListener(listener);
339343
}
340344
});
341345
}
342346

347+
public static <T> void registerSingle(ConfigurableBootstrapContext bootstrapContext, Class<T> cls, T instance,
348+
String name) {
349+
registerSingle(bootstrapContext, cls, instance, name, NO_OP);
350+
}
351+
343352
/**
344353
* append prefix to the keys and return a new Map with the new values.
345354
*/

spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/config/SecretsPropertySourceLocator.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import java.util.EnumSet;
2727
import java.util.HashSet;
2828
import java.util.List;
29+
import java.util.Locale;
2930
import java.util.Objects;
3031
import java.util.Set;
3132
import java.util.function.BiConsumer;
@@ -177,7 +178,7 @@ private SecretsPropertySource property(Path filePath) {
177178

178179
try {
179180
String content = new String(Files.readAllBytes(filePath)).trim();
180-
String sourceName = fileName.toLowerCase();
181+
String sourceName = fileName.toLowerCase(Locale.ROOT);
181182
SourceData sourceData = new SourceData(sourceName, Collections.singletonMap(fileName, content));
182183
return new SecretsPropertySource(sourceData);
183184
}

0 commit comments

Comments
 (0)