Merge branch '3.3.x' into 3.4.x

Closes gh-44684
This commit is contained in:
Stéphane Nicoll 2025-03-12 08:55:35 +01:00
commit 322191f288
8 changed files with 15 additions and 19 deletions

View File

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

View File

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

View File

@ -44,7 +44,7 @@ import org.springframework.context.annotation.DependsOn;
public @interface AutoConfigureBefore { 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 * @return the classes
*/ */
Class<?>[] value() default {}; Class<?>[] value() default {};

View File

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

View File

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

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

View File

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

View File

@ -169,7 +169,7 @@ import static org.mockito.ArgumentMatchers.any;
import static org.mockito.BDDMockito.then; import static org.mockito.BDDMockito.then;
import static org.mockito.Mockito.inOrder; import static org.mockito.Mockito.inOrder;
import static org.mockito.Mockito.mock; 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}. * 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 = getFactory().getWebServer((servletContext) -> servletContext.addListener(listener));
this.webServer.start(); this.webServer.start();
this.webServer.stop(); this.webServer.stop();
then(listener).should(times(0)).contextDestroyed(any(ServletContextEvent.class)); then(listener).should(never()).contextDestroyed(any(ServletContextEvent.class));
} }
@Test @Test