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:
		
							parent
							
								
									47285f9f02
								
							
						
					
					
						commit
						d2198c417d
					
				| 
						 | 
					@ -20,6 +20,8 @@ import javax.jms.ConnectionFactory;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import org.apache.activemq.ActiveMQConnectionFactory;
 | 
					import org.apache.activemq.ActiveMQConnectionFactory;
 | 
				
			||||||
import org.apache.activemq.pool.PooledConnectionFactory;
 | 
					import org.apache.activemq.pool.PooledConnectionFactory;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
 | 
				
			||||||
import org.springframework.context.annotation.Bean;
 | 
					import org.springframework.context.annotation.Bean;
 | 
				
			||||||
import org.springframework.context.annotation.Configuration;
 | 
					import org.springframework.context.annotation.Configuration;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -32,6 +34,7 @@ import org.springframework.context.annotation.Configuration;
 | 
				
			||||||
 * @since 1.1.0
 | 
					 * @since 1.1.0
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
@Configuration
 | 
					@Configuration
 | 
				
			||||||
 | 
					@ConditionalOnMissingBean(ConnectionFactory.class)
 | 
				
			||||||
class ActiveMQConnectionFactoryConfiguration {
 | 
					class ActiveMQConnectionFactoryConfiguration {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@Bean
 | 
						@Bean
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue