Skip to content

ActiveMQConnectionFactory is not configured when CachingConnectionFactory is missing and enabled properties are false #17483

@nosan

Description

@nosan

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: supersededAn issue that has been superseded by anothertype: bugA general bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions