Do not create create a new ConnectionFactory if one already exists in parent

Fix #63

Make sure that the creation of a new `ConnectionFactory` when
cloud connectors are used is done only when the binder
context is not a child of the main context, otherwise inherit
the connection factory as in normal case. This ensures that its lifecycle
is in sync with the parent.
This commit is contained in:
Marius Bogoevici
2017-04-20 14:07:38 -04:00
committed by Gary Russell
parent 964339c4fe
commit 80294c4acc

View File

@@ -91,6 +91,7 @@ public class RabbitServiceAutoConfiguration {
* @return the {@link ConnectionFactory} used by the binder.
*/
@Bean
@ConditionalOnMissingBean(ConnectionFactory.class)
ConnectionFactory rabbitConnectionFactory(Cloud cloud) {
return cloud.getSingletonServiceConnector(ConnectionFactory.class, null);
}