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
This commit is contained in:
Stephane Nicoll 2014-10-21 18:28:26 +02:00
parent 47285f9f02
commit d2198c417d
1 changed files with 3 additions and 0 deletions

View File

@ -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;
* @since 1.1.0
*/
@Configuration
@ConditionalOnMissingBean(ConnectionFactory.class)
class ActiveMQConnectionFactoryConfiguration {
@Bean