Browse Source

Merge branch '3.4.x'

Closes gh-44685
pull/44655/head
Stéphane Nicoll 1 year ago
parent
commit
3ea9c56ea0
  1. 5
      spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/data/redis/RedisReactiveHealthContributorAutoConfiguration.java
  2. 3
      spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/health/AbstractCompositeHealthContributorConfigurationTests.java
  3. 6
      spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/SanitizingFunctionTests.java
  4. 2
      spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigureBefore.java
  5. 1
      spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/cassandra/CassandraReactiveDataAutoConfigurationTests.java
  6. 13
      spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/ldap/LdapAutoConfigurationTests.java
  7. 2
      spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/Builder.java
  8. 4
      spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/DockerApi.java
  9. 4
      spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/DockerLog.java
  10. 6
      spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/build/BuilderTests.java
  11. 2
      spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystem.java
  12. 12
      spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/context/ServletWebServerApplicationContext.java
  13. 2
      spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/structured/StructuredLoggingJsonPropertiesTests.java
  14. 3
      spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/context/ReactiveWebServerApplicationContextTests.java
  15. 3
      spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/context/ServletWebServerApplicationContextTests.java
  16. 4
      spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/server/AbstractServletWebServerFactoryTests.java
  17. 2
      spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-elasticsearch/build.gradle
  18. 2
      spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-elasticsearch/src/dockerTest/java/smoketest/data/elasticsearch/SampleElasticsearch8ApplicationTests.java
  19. 2
      spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-elasticsearch/src/dockerTest/java/smoketest/data/elasticsearch/SampleElasticsearchApplicationTests.java
  20. 2
      spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-elasticsearch/src/dockerTest/java/smoketest/data/elasticsearch/SampleElasticsearchSslApplicationTests.java

5
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/data/redis/RedisReactiveHealthContributorAutoConfiguration.java

@ -16,8 +16,6 @@ @@ -16,8 +16,6 @@
package org.springframework.boot.actuate.autoconfigure.data.redis;
import java.util.Map;
import reactor.core.publisher.Flux;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
@ -51,8 +49,7 @@ import org.springframework.data.redis.connection.ReactiveRedisConnectionFactory; @@ -51,8 +49,7 @@ import org.springframework.data.redis.connection.ReactiveRedisConnectionFactory;
public class RedisReactiveHealthContributorAutoConfiguration extends
CompositeReactiveHealthContributorConfiguration<RedisReactiveHealthIndicator, ReactiveRedisConnectionFactory> {
RedisReactiveHealthContributorAutoConfiguration(
Map<String, ReactiveRedisConnectionFactory> redisConnectionFactories) {
RedisReactiveHealthContributorAutoConfiguration() {
super(RedisReactiveHealthIndicator::new);
}

3
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/health/AbstractCompositeHealthContributorConfigurationTests.java

@ -123,13 +123,11 @@ abstract class AbstractCompositeHealthContributorConfigurationTests<C, I extends @@ -123,13 +123,11 @@ abstract class AbstractCompositeHealthContributorConfigurationTests<C, I extends
@Bean(defaultCandidate = false)
TestBean nonDefault() {
return new TestBean();
}
@Bean(autowireCandidate = false)
TestBean nonAutowire() {
return new TestBean();
}
}
@ -145,7 +143,6 @@ abstract class AbstractCompositeHealthContributorConfigurationTests<C, I extends @@ -145,7 +143,6 @@ abstract class AbstractCompositeHealthContributorConfigurationTests<C, I extends
@Bean(autowireCandidate = false)
TestBean nonAutowire() {
return new TestBean();
}
}

6
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/SanitizingFunctionTests.java

@ -60,7 +60,7 @@ class SanitizingFunctionTests { @@ -60,7 +60,7 @@ class SanitizingFunctionTests {
void ifLikelySensitiveFiltersExpected() {
SanitizingFunction function = SanitizingFunction.sanitizeValue().ifLikelySensitive();
assertThat(function).satisfies(this::likelyCredentialChecks, this::likelyUriChecks,
this::likelySenstivePropertyChecks, this::vcapServicesChecks);
this::likelySensitivePropertyChecks, this::vcapServicesChecks);
}
@Test
@ -103,10 +103,10 @@ class SanitizingFunctionTests { @@ -103,10 +103,10 @@ class SanitizingFunctionTests {
@Test
void ifLikelySensitivePropertyFiltersExpected() {
SanitizingFunction function = SanitizingFunction.sanitizeValue().ifLikelySensitiveProperty();
assertThat(function).satisfies(this::likelySenstivePropertyChecks);
assertThat(function).satisfies(this::likelySensitivePropertyChecks);
}
private void likelySenstivePropertyChecks(SanitizingFunction function) {
private void likelySensitivePropertyChecks(SanitizingFunction function) {
assertThatApplyingToKey(function, "sun.java.command").has(sanitizedValue());
assertThatApplyingToKey(function, "spring.application.json").has(sanitizedValue());
assertThatApplyingToKey(function, "SPRING_APPLICATION_JSON").has(sanitizedValue());

2
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigureBefore.java

@ -44,7 +44,7 @@ import org.springframework.context.annotation.DependsOn; @@ -44,7 +44,7 @@ import org.springframework.context.annotation.DependsOn;
public @interface AutoConfigureBefore {
/**
* The auto-configure classes that should have not yet been applied.
* The auto-configuration classes that should have not yet been applied.
* @return the classes
*/
Class<?>[] value() default {};

1
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/cassandra/CassandraReactiveDataAutoConfigurationTests.java

@ -79,7 +79,6 @@ class CassandraReactiveDataAutoConfigurationTests { @@ -79,7 +79,6 @@ class CassandraReactiveDataAutoConfigurationTests {
@Test
void userTypeResolverShouldBeSet() {
this.contextRunner.run((context) -> {
assertThat(context).hasSingleBean(CassandraConverter.class);
assertThat(context).hasSingleBean(CassandraConverter.class);
assertThat(context.getBean(CassandraConverter.class)).extracting("userTypeResolver")
.isInstanceOf(SimpleUserTypeResolver.class);

13
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/ldap/LdapAutoConfigurationTests.java

@ -142,13 +142,12 @@ class LdapAutoConfigurationTests { @@ -142,13 +142,12 @@ class LdapAutoConfigurationTests {
this.contextRunner.withPropertyValues("spring.ldap.urls:ldap://localhost:389").run((context) -> {
assertThat(context).hasSingleBean(ObjectDirectoryMapper.class);
ObjectDirectoryMapper objectDirectoryMapper = context.getBean(ObjectDirectoryMapper.class);
ApplicationConversionService conversionService = assertThat(objectDirectoryMapper)
.extracting("converterManager")
.extracting("conversionService")
.asInstanceOf(InstanceOfAssertFactories.type(ApplicationConversionService.class))
.actual();
assertThat(conversionService.canConvert(String.class, Name.class)).isTrue();
assertThat(conversionService.canConvert(Name.class, String.class)).isTrue();
assertThat(objectDirectoryMapper).extracting("converterManager")
.extracting("conversionService", InstanceOfAssertFactories.type(ApplicationConversionService.class))
.satisfies((conversionService) -> {
assertThat(conversionService.canConvert(String.class, Name.class)).isTrue();
assertThat(conversionService.canConvert(Name.class, String.class)).isTrue();
});
});
}

2
spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/Builder.java

@ -300,7 +300,7 @@ public class Builder { @@ -300,7 +300,7 @@ public class Builder {
}
/**
* Creates{@link DockerLog} instance based on the provided {@link BuildLog}.
* Creates {@link DockerLog} instance based on the provided {@link BuildLog}.
* <p>
* If the provided {@link BuildLog} instance is an {@link AbstractBuildLog}, the
* method returns a {@link BuildLogAdapter}, otherwise it returns a default

4
spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/DockerApi.java

@ -87,7 +87,7 @@ public class DockerApi { @@ -87,7 +87,7 @@ public class DockerApi {
* Create a new {@link DockerApi} instance.
*/
public DockerApi() {
this(HttpTransport.create(null), DockerLog.toSystemOut());
this(null);
}
/**
@ -96,7 +96,7 @@ public class DockerApi { @@ -96,7 +96,7 @@ public class DockerApi {
* @since 2.4.0
*/
public DockerApi(DockerHostConfiguration dockerHost) {
this(HttpTransport.create(dockerHost), DockerLog.toSystemOut());
this(dockerHost, DockerLog.toSystemOut());
}
/**

4
spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/DockerLog.java

@ -34,7 +34,7 @@ public interface DockerLog { @@ -34,7 +34,7 @@ public interface DockerLog {
void log(String message);
/**
* Factory method that returns a {@link DockerLog} the outputs to {@link System#out}.
* Factory method that returns a {@link DockerLog} that outputs to {@link System#out}.
* @return {@link DockerLog} instance that logs to system out
*/
static DockerLog toSystemOut() {
@ -42,7 +42,7 @@ public interface DockerLog { @@ -42,7 +42,7 @@ public interface DockerLog {
}
/**
* Factory method that returns a {@link DockerLog} the outputs to a given
* Factory method that returns a {@link DockerLog} that outputs to a given
* {@link PrintStream}.
* @param out the print stream used to output the log
* @return {@link DockerLog} instance that logs to the given print stream

6
spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/build/BuilderTests.java

@ -47,6 +47,7 @@ import static org.assertj.core.api.Assertions.assertThat; @@ -47,6 +47,7 @@ import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
import static org.assertj.core.api.Assertions.assertThatNoException;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.ArgumentMatchers.isNull;
@ -73,14 +74,12 @@ class BuilderTests { @@ -73,14 +74,12 @@ class BuilderTests {
@Test
void createWithDockerConfiguration() {
Builder builder = new Builder(BuildLog.toSystemOut());
assertThat(builder).isNotNull();
assertThatNoException().isThrownBy(() -> new Builder(BuildLog.toSystemOut()));
}
@Test
void createDockerApiWithLogDockerLogDelegate() {
Builder builder = new Builder(BuildLog.toSystemOut());
assertThat(builder).isNotNull();
assertThat(builder).extracting("docker")
.extracting("system")
.extracting("log")
@ -90,7 +89,6 @@ class BuilderTests { @@ -90,7 +89,6 @@ class BuilderTests {
@Test
void createDockerApiWithLogDockerSystemOutDelegate() {
Builder builder = new Builder(mock(BuildLog.class));
assertThat(builder).isNotNull();
assertThat(builder).extracting("docker")
.extracting("system")
.extracting("log")

2
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystem.java

@ -447,7 +447,7 @@ public class Log4J2LoggingSystem extends AbstractLoggingSystem { @@ -447,7 +447,7 @@ public class Log4J2LoggingSystem extends AbstractLoggingSystem {
super.cleanUp();
LoggerContext loggerContext = getLoggerContext();
markAsUninitialized(loggerContext);
StatusConsoleListener listener = (StatusConsoleListener) getLoggerContext().getObject(STATUS_LISTENER_KEY);
StatusConsoleListener listener = (StatusConsoleListener) loggerContext.getObject(STATUS_LISTENER_KEY);
if (listener != null) {
StatusLogger.getLogger().removeListener(listener);
loggerContext.removeObject(STATUS_LISTENER_KEY);

12
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/context/ServletWebServerApplicationContext.java

@ -146,15 +146,15 @@ public class ServletWebServerApplicationContext extends GenericWebApplicationCon @@ -146,15 +146,15 @@ public class ServletWebServerApplicationContext extends GenericWebApplicationCon
super.refresh();
}
catch (RuntimeException ex) {
try {
WebServer webServer = this.webServer;
if (webServer != null) {
WebServer webServer = this.webServer;
if (webServer != null) {
try {
webServer.stop();
webServer.destroy();
}
}
catch (RuntimeException stopOrDestroyEx) {
ex.addSuppressed(stopOrDestroyEx);
catch (RuntimeException stopOrDestroyEx) {
ex.addSuppressed(stopOrDestroyEx);
}
}
throw ex;
}

2
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/structured/StructuredLoggingJsonPropertiesTests.java

@ -187,7 +187,7 @@ class StructuredLoggingJsonPropertiesTests { @@ -187,7 +187,7 @@ class StructuredLoggingJsonPropertiesTests {
}
@Test
void shouldReturnFalseWhenPrinterIsEmpty() {
void hasCustomPrinterShouldReturnFalseWhenPrinterIsEmpty() {
StackTrace stackTrace = new StackTrace("", null, null, null, null, null);
assertThat(stackTrace.hasCustomPrinter()).isFalse();
}

3
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/context/ReactiveWebServerApplicationContextTests.java

@ -44,6 +44,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType; @@ -44,6 +44,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
import static org.mockito.BDDMockito.then;
import static org.mockito.BDDMockito.willThrow;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
/**
@ -148,7 +149,7 @@ class ReactiveWebServerApplicationContextTests { @@ -148,7 +149,7 @@ class ReactiveWebServerApplicationContextTests {
.withStackTraceContaining("WebServer has failed to stop");
WebServer webServer = this.context.getWebServer();
then(webServer).should().stop();
then(webServer).should(times(0)).destroy();
then(webServer).should(never()).destroy();
}
@Test

3
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/context/ServletWebServerApplicationContextTests.java

@ -86,6 +86,7 @@ import static org.mockito.BDDMockito.willThrow; @@ -86,6 +86,7 @@ import static org.mockito.BDDMockito.willThrow;
import static org.mockito.Mockito.atMost;
import static org.mockito.Mockito.inOrder;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.withSettings;
@ -236,7 +237,7 @@ class ServletWebServerApplicationContextTests { @@ -236,7 +237,7 @@ class ServletWebServerApplicationContextTests {
.withStackTraceContaining("WebServer has failed to stop");
WebServer webServer = this.context.getWebServer();
then(webServer).should().stop();
then(webServer).should(times(0)).destroy();
then(webServer).should(never()).destroy();
}
@Test

4
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/server/AbstractServletWebServerFactoryTests.java

@ -169,7 +169,7 @@ import static org.mockito.ArgumentMatchers.any; @@ -169,7 +169,7 @@ import static org.mockito.ArgumentMatchers.any;
import static org.mockito.BDDMockito.then;
import static org.mockito.Mockito.inOrder;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.never;
/**
* Base for testing classes that extends {@link AbstractServletWebServerFactory}.
@ -1193,7 +1193,7 @@ public abstract class AbstractServletWebServerFactoryTests { @@ -1193,7 +1193,7 @@ public abstract class AbstractServletWebServerFactoryTests {
this.webServer = getFactory().getWebServer((servletContext) -> servletContext.addListener(listener));
this.webServer.start();
this.webServer.stop();
then(listener).should(times(0)).contextDestroyed(any(ServletContextEvent.class));
then(listener).should(never()).contextDestroyed(any(ServletContextEvent.class));
}
@Test

2
spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-elasticsearch/build.gradle

@ -4,7 +4,7 @@ plugins { @@ -4,7 +4,7 @@ plugins {
id "org.springframework.boot.docker-test"
}
description = "Spring Boot Data ElasticSearch smoke test"
description = "Spring Boot Data Elasticsearch smoke test"
dependencies {
dockerTestImplementation(project(":spring-boot-project:spring-boot-starters:spring-boot-starter-test"))

2
spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-elasticsearch/src/dockerTest/java/smoketest/data/elasticsearch/SampleElasticSearch8ApplicationTests.java → spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-elasticsearch/src/dockerTest/java/smoketest/data/elasticsearch/SampleElasticsearch8ApplicationTests.java

@ -39,7 +39,7 @@ import static org.assertj.core.api.Assertions.assertThat; @@ -39,7 +39,7 @@ import static org.assertj.core.api.Assertions.assertThat;
*/
@Testcontainers(disabledWithoutDocker = true)
@DataElasticsearchTest
class SampleElasticSearch8ApplicationTests {
class SampleElasticsearch8ApplicationTests {
@Container
@ServiceConnection

2
spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-elasticsearch/src/dockerTest/java/smoketest/data/elasticsearch/SampleElasticSearchApplicationTests.java → spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-elasticsearch/src/dockerTest/java/smoketest/data/elasticsearch/SampleElasticsearchApplicationTests.java

@ -38,7 +38,7 @@ import static org.assertj.core.api.Assertions.assertThat; @@ -38,7 +38,7 @@ import static org.assertj.core.api.Assertions.assertThat;
*/
@Testcontainers(disabledWithoutDocker = true)
@DataElasticsearchTest
class SampleElasticSearchApplicationTests {
class SampleElasticsearchApplicationTests {
@Container
@ServiceConnection

2
spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-elasticsearch/src/dockerTest/java/smoketest/data/elasticsearch/SampleElasticSearchSslApplicationTests.java → spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-elasticsearch/src/dockerTest/java/smoketest/data/elasticsearch/SampleElasticsearchSslApplicationTests.java

@ -40,7 +40,7 @@ import static org.assertj.core.api.Assertions.assertThat; @@ -40,7 +40,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@Testcontainers(disabledWithoutDocker = true)
@DataElasticsearchTest(
properties = { "spring.elasticsearch.connection-timeout=120s", "spring.elasticsearch.socket-timeout=120s" })
class SampleElasticSearchSslApplicationTests {
class SampleElasticsearchSslApplicationTests {
@Container
@ServiceConnection
Loading…
Cancel
Save