Skip to content

Commit da69286

Browse files
committed
Merge branch '2.3.x'
2 parents 0768ade + 187d3af commit da69286

File tree

25 files changed

+75
-77
lines changed

25 files changed

+75
-77
lines changed

ci/images/releasescripts/src/main/java/io/spring/concourse/releasescripts/artifactory/ArtifactoryService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

ci/images/releasescripts/src/main/java/io/spring/concourse/releasescripts/artifactory/payload/BuildInfoResponse.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

ci/images/releasescripts/src/main/java/io/spring/concourse/releasescripts/bintray/PackageFile.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2020 the original author or authors.
2+
* Copyright 2020-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

ci/images/releasescripts/src/main/java/io/spring/concourse/releasescripts/command/CommandProcessor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

ci/images/releasescripts/src/main/java/io/spring/concourse/releasescripts/command/DistributeCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

ci/images/releasescripts/src/main/java/io/spring/concourse/releasescripts/command/PromoteCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

ci/images/releasescripts/src/main/java/io/spring/concourse/releasescripts/command/PublishGradlePlugin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

ci/images/releasescripts/src/main/java/io/spring/concourse/releasescripts/command/SyncToCentralCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

ci/images/releasescripts/src/main/java/io/spring/concourse/releasescripts/sonatype/SonatypeService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

ci/images/releasescripts/src/test/java/io/spring/concourse/releasescripts/bintray/BintrayServiceTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

ci/images/releasescripts/src/test/java/io/spring/concourse/releasescripts/command/DistributeCommandTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

ci/images/releasescripts/src/test/java/io/spring/concourse/releasescripts/sonatype/SonatypeServiceTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/elasticsearch/ElasticsearchReactiveHealthIndicator.java

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,11 @@
2323
import org.springframework.boot.actuate.health.AbstractReactiveHealthIndicator;
2424
import org.springframework.boot.actuate.health.Health;
2525
import org.springframework.boot.actuate.health.HealthIndicator;
26+
import org.springframework.boot.actuate.health.Status;
2627
import org.springframework.core.ParameterizedTypeReference;
2728
import org.springframework.data.elasticsearch.client.reactive.ReactiveElasticsearchClient;
29+
import org.springframework.web.reactive.function.client.ClientResponse;
30+
import org.springframework.web.reactive.function.client.WebClient;
2831

2932
/**
3033
* {@link HealthIndicator} for an Elasticsearch cluster using a
@@ -50,28 +53,28 @@ public ElasticsearchReactiveHealthIndicator(ReactiveElasticsearchClient client)
5053

5154
@Override
5255
protected Mono<Health> doHealthCheck(Health.Builder builder) {
53-
return this.client.execute((callback) -> callback.get().uri("/_cluster/health/").exchange())
54-
.flatMap((response) -> {
55-
if (response.statusCode().is2xxSuccessful()) {
56-
return response.bodyToMono(STRING_OBJECT_MAP).map((body) -> {
57-
String status = (String) body.get("status");
58-
if (RED_STATUS.equals(status)) {
59-
builder.outOfService();
60-
}
61-
else {
62-
builder.up();
63-
}
64-
builder.withDetails(body);
65-
return builder.build();
66-
});
67-
}
68-
else {
69-
builder.down();
70-
builder.withDetail("statusCode", response.rawStatusCode());
71-
builder.withDetail("reasonPhrase", response.statusCode().getReasonPhrase());
72-
return response.releaseBody().thenReturn(builder.build());
73-
}
74-
});
56+
return this.client.execute(this::getHealth).flatMap((response) -> doHealthCheck(builder, response));
57+
}
58+
59+
private Mono<ClientResponse> getHealth(WebClient webClient) {
60+
return webClient.get().uri("/_cluster/health/").exchange();
61+
}
62+
63+
private Mono<Health> doHealthCheck(Health.Builder builder, ClientResponse response) {
64+
if (response.statusCode().is2xxSuccessful()) {
65+
return response.bodyToMono(STRING_OBJECT_MAP).map((body) -> getHealth(builder, body));
66+
}
67+
builder.down();
68+
builder.withDetail("statusCode", response.rawStatusCode());
69+
builder.withDetail("reasonPhrase", response.statusCode().getReasonPhrase());
70+
return response.releaseBody().thenReturn(builder.build());
71+
}
72+
73+
private Health getHealth(Health.Builder builder, Map<String, Object> body) {
74+
String status = (String) body.get("status");
75+
builder.status(RED_STATUS.equals(status) ? Status.OUT_OF_SERVICE : Status.UP);
76+
builder.withDetails(body);
77+
return builder.build();
7578
}
7679

7780
}

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/redis/RedisHealthIndicator.java

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -16,8 +16,6 @@
1616

1717
package org.springframework.boot.actuate.redis;
1818

19-
import java.util.Properties;
20-
2119
import org.springframework.boot.actuate.health.AbstractHealthIndicator;
2220
import org.springframework.boot.actuate.health.Health;
2321
import org.springframework.boot.actuate.health.HealthIndicator;
@@ -39,15 +37,7 @@
3937
*/
4038
public class RedisHealthIndicator extends AbstractHealthIndicator {
4139

42-
static final String VERSION = "version";
43-
44-
static final String CLUSTER_SIZE = "cluster_size";
45-
46-
static final String SLOTS_UP = "slots_up";
47-
48-
static final String SLOTS_FAIL = "slots_fail";
49-
50-
static final String REDIS_VERSION = "redis_version";
40+
private static final String REDIS_VERSION_PROPERTY = "redis_version";
5141

5242
private final RedisConnectionFactory redisConnectionFactory;
5343

@@ -61,20 +51,24 @@ public RedisHealthIndicator(RedisConnectionFactory connectionFactory) {
6151
protected void doHealthCheck(Health.Builder builder) throws Exception {
6252
RedisConnection connection = RedisConnectionUtils.getConnection(this.redisConnectionFactory);
6353
try {
64-
if (connection instanceof RedisClusterConnection) {
65-
ClusterInfo clusterInfo = ((RedisClusterConnection) connection).clusterGetClusterInfo();
66-
builder.up().withDetail(CLUSTER_SIZE, clusterInfo.getClusterSize())
67-
.withDetail(SLOTS_UP, clusterInfo.getSlotsOk())
68-
.withDetail(SLOTS_FAIL, clusterInfo.getSlotsFail());
69-
}
70-
else {
71-
Properties info = connection.info();
72-
builder.up().withDetail(VERSION, info.getProperty(REDIS_VERSION));
73-
}
54+
doHealthCheck(builder, connection);
7455
}
7556
finally {
7657
RedisConnectionUtils.releaseConnection(connection, this.redisConnectionFactory, false);
7758
}
7859
}
7960

61+
private void doHealthCheck(Health.Builder builder, RedisConnection connection) {
62+
if (connection instanceof RedisClusterConnection) {
63+
ClusterInfo clusterInfo = ((RedisClusterConnection) connection).clusterGetClusterInfo();
64+
builder.up().withDetail("cluster_size", clusterInfo.getClusterSize())
65+
.withDetail("slots_up", clusterInfo.getSlotsOk())
66+
.withDetail("slots_fail", clusterInfo.getSlotsFail());
67+
}
68+
else {
69+
String version = connection.info().getProperty(REDIS_VERSION_PROPERTY);
70+
builder.up().withDetail("version", version);
71+
}
72+
}
73+
8074
}

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/redis/RedisReactiveHealthIndicator.java

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@
4040
*/
4141
public class RedisReactiveHealthIndicator extends AbstractReactiveHealthIndicator {
4242

43+
private static final String REDIS_VERSION_PROPERTY = "redis_version";
44+
4345
private final ReactiveRedisConnectionFactory connectionFactory;
4446

4547
public RedisReactiveHealthIndicator(ReactiveRedisConnectionFactory connectionFactory) {
@@ -59,11 +61,9 @@ private Mono<Health> doHealthCheck(Health.Builder builder, ReactiveRedisConnecti
5961
.onErrorResume((ex) -> Mono.just(down(builder, ex)))
6062
.flatMap((health) -> clusterConnection.closeLater().thenReturn(health));
6163
}
62-
else {
63-
return connection.serverCommands().info().map((info) -> up(builder, info))
64-
.onErrorResume((ex) -> Mono.just(down(builder, ex)))
65-
.flatMap((health) -> connection.closeLater().thenReturn(health));
66-
}
64+
return connection.serverCommands().info().map((info) -> up(builder, info))
65+
.onErrorResume((ex) -> Mono.just(down(builder, ex)))
66+
.flatMap((health) -> connection.closeLater().thenReturn(health));
6767
}
6868

6969
private Mono<ReactiveRedisConnection> getConnection() {
@@ -72,14 +72,13 @@ private Mono<ReactiveRedisConnection> getConnection() {
7272
}
7373

7474
private Health up(Health.Builder builder, Properties info) {
75-
return builder.up()
76-
.withDetail(RedisHealthIndicator.VERSION, info.getProperty(RedisHealthIndicator.REDIS_VERSION)).build();
75+
return builder.up().withDetail("version", info.getProperty(REDIS_VERSION_PROPERTY)).build();
7776
}
7877

7978
private Health up(Health.Builder builder, ClusterInfo clusterInfo) {
80-
return builder.up().withDetail(RedisHealthIndicator.CLUSTER_SIZE, clusterInfo.getClusterSize())
81-
.withDetail(RedisHealthIndicator.SLOTS_UP, clusterInfo.getSlotsOk())
82-
.withDetail(RedisHealthIndicator.SLOTS_FAIL, clusterInfo.getSlotsFail()).build();
79+
return builder.up().withDetail("cluster_size", clusterInfo.getClusterSize())
80+
.withDetail("slots_up", clusterInfo.getSlotsOk()).withDetail("slots_fail", clusterInfo.getSlotsFail())
81+
.build();
8382
}
8483

8584
private Health down(Health.Builder builder, Throwable cause) {

spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/redis/RedisReactiveHealthIndicatorTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/kafka/KafkaStreamsAnnotationDrivenConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mustache/MustacheEnvironmentCollector.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/jpa/JpaWebAutoConfigurationTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/MustacheStandaloneIntegrationTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

spring-boot-project/spring-boot-docs/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ dependencies {
9595
testImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support"))
9696
testImplementation("org.assertj:assertj-core")
9797
testImplementation("org.junit.jupiter:junit-jupiter")
98-
98+
9999
testRuntimeOnly(project(":spring-boot-project:spring-boot-starters:spring-boot-starter-web"))
100100
testRuntimeOnly("com.h2database:h2")
101101
testRuntimeOnly("org.springframework:spring-jdbc")

spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/DefinitionsParser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/transport/LocalHttpClientTransport.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,10 @@ static LocalHttpClientTransport create(Environment environment) {
6969

7070
private static String socketFilePath(Environment environment) {
7171
String host = environment.get(DOCKER_HOST);
72-
return (host != null && host.startsWith(UNIX_SOCKET_PREFIX)) ? host.substring(UNIX_SOCKET_PREFIX.length())
73-
: host;
72+
if (host != null && host.startsWith(UNIX_SOCKET_PREFIX)) {
73+
return host.substring(UNIX_SOCKET_PREFIX.length());
74+
}
75+
return host;
7476
}
7577

7678
/**

spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/io/ZipFileTarArchive.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public void writeTo(OutputStream outputStream) throws IOException {
7676

7777
private void assertArchiveHasEntries(File jarFile) {
7878
try (ZipFile zipFile = new ZipFile(jarFile)) {
79-
Assert.state(zipFile.getEntries().hasMoreElements(), "File '" + jarFile.toString()
79+
Assert.state(zipFile.getEntries().hasMoreElements(), () -> "File '" + jarFile
8080
+ "' is not compatible with buildpacks; ensure jar file is valid and launch script is not enabled");
8181
}
8282
catch (IOException ex) {

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/RestTemplateBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

0 commit comments

Comments
 (0)