Skip to content

Commit b8021db

Browse files
committed
Exclude Rabbit Stream when testing RabbitAutoConfiguration
The stream auto-configuration is tested in RabbitStreamConfigurationTests, and excluding it prevents the creation of the "rabbitStreamEnvironment" Environment bean, which delays the application context close by 1 second because it has to wait for some Netty resources to gracefully shut down. Closes gh-38750
1 parent af8e6a4 commit b8021db

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfigurationTests.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
import org.springframework.amqp.support.converter.MessageConverter;
5959
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
6060
import org.springframework.boot.autoconfigure.AutoConfigurations;
61+
import org.springframework.boot.test.context.FilteredClassLoader;
6162
import org.springframework.boot.test.context.assertj.AssertableApplicationContext;
6263
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
6364
import org.springframework.boot.test.system.CapturedOutput;
@@ -104,7 +105,8 @@
104105
class RabbitAutoConfigurationTests {
105106

106107
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
107-
.withConfiguration(AutoConfigurations.of(RabbitAutoConfiguration.class));
108+
.withConfiguration(AutoConfigurations.of(RabbitAutoConfiguration.class))
109+
.withClassLoader(new FilteredClassLoader("org.springframework.rabbit.stream")); // gh-38750
108110

109111
@Test
110112
void testDefaultRabbitConfiguration() {

0 commit comments

Comments
 (0)