Merge branch '3.4.x'

Closes gh-44685
This commit is contained in:
Stéphane Nicoll 2025-03-12 08:59:09 +01:00
commit 3ea9c56ea0
20 changed files with 36 additions and 44 deletions

View File

@ -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;
public class RedisReactiveHealthContributorAutoConfiguration extends
CompositeReactiveHealthContributorConfiguration<RedisReactiveHealthIndicator, ReactiveRedisConnectionFactory> {
RedisReactiveHealthContributorAutoConfiguration(
Map<String, ReactiveRedisConnectionFactory> redisConnectionFactories) {
RedisReactiveHealthContributorAutoConfiguration() {
super(RedisReactiveHealthIndicator::new);
}

View File

@ -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
@Bean(autowireCandidate = false)
TestBean nonAutowire() {
return new TestBean();
}
}

View File

@ -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 {
@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());

View File

@ -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 {};

View File

@ -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);

View File

@ -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();
});
});
}

View File

@ -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

View File

@ -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 {
* @since 2.4.0
*/
public DockerApi(DockerHostConfiguration dockerHost) {
this(HttpTransport.create(dockerHost), DockerLog.toSystemOut());
this(dockerHost, DockerLog.toSystemOut());
}
/**

View File

@ -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 {
}
/**
* 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

View File

@ -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 {
@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 {
@Test
void createDockerApiWithLogDockerSystemOutDelegate() {
Builder builder = new Builder(mock(BuildLog.class));
assertThat(builder).isNotNull();
assertThat(builder).extracting("docker")
.extracting("system")
.extracting("log")

View File

@ -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);

View File

@ -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;
}

View File

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

View File

@ -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 {
.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

View File

@ -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 {
.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

View File

@ -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 {
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

View File

@ -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"))

View File

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

View File

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

View File

@ -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