Browse Source

Fix ConnectionFactory auto-configuration with XA

Previously, the regular jms connection factory was always overriding
the xaConnectionFactory when using ActiveMQ. While
ActiveMQAutoConfiguration is namely shielded with a condition on a
missing ConnectionFactory bean, said configuration class also imports the
XA and regular configuration classes that both can create the connection
factory.

This commit adds a ConditionalOnMissingBean in the second class that is
imported in case the XA configuration has already defined what it needs.

Fixes gh-1727
pull/1743/head
Stephane Nicoll 11 years ago
parent
commit
d2198c417d
  1. 3
      spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQConnectionFactoryConfiguration.java

3
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQConnectionFactoryConfiguration.java

@ -20,6 +20,8 @@ import javax.jms.ConnectionFactory; @@ -20,6 +20,8 @@ import javax.jms.ConnectionFactory;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.pool.PooledConnectionFactory;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@ -32,6 +34,7 @@ import org.springframework.context.annotation.Configuration; @@ -32,6 +34,7 @@ import org.springframework.context.annotation.Configuration;
* @since 1.1.0
*/
@Configuration
@ConditionalOnMissingBean(ConnectionFactory.class)
class ActiveMQConnectionFactoryConfiguration {
@Bean

Loading…
Cancel
Save