When both properties spring.activemq.pool.enabled and spring.jms.cache.enabled set to false and CachingConnectionFactory is not on the classpath then ActiveMQAutoConfiguration will not register ActiveMQConnectionFactory bean.
@RunWith(ModifiedClassPathRunner.class)
@ClassPathExclusions("spring-jms-*.jar")
public class ActiveMQAutoConfigurationTestsWithoutCachingConnectionFactoryTests {
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
.withConfiguration(AutoConfigurations.of(ActiveMQAutoConfiguration.class));
@Test
public void whenThereIsNoCachingConnectionFactoryOnTheClasspathThenSimpleConnectionFactoryAutoConfigured() {
this.contextRunner.withPropertyValues("spring.activemq.pool.enabled=false", "spring.jms.cache.enabled=false")
.run((context) -> assertThat(context).hasSingleBean(ActiveMQConnectionFactory.class));
}
}
It happens because @ConditionalOnClass(CachingConnectionFactory.class) is present on ActiveMQConnectionFactoryConfiguration$SimpleConnectionFactoryConfiguration configuration class.