INT-4252 IntegrationFlow: Allow Custom Bean Names

JIRA: https://jira.spring.io/browse/INT-4252

To allow to provide arbitrary bean names for the intermediate components
in the `IntegrationFlow` change `ComponentsRegistration` to return
a `Map<Object, String>` instead of raw `Collection<Object>`

* Use the value from that map in the `IntegrationFlowBeanPostProcessor` as a
fallback option before walking into bean name generation
* Provide `containerId` option for the AMQP DSL components

* Revert `@AfterClass` in the `AmqpTests`
* Expose `id()` for the `JmsDestinationAccessorSpec`
* Register `ListenerContainer` and `JmsTemplate`
as bean via `ComponentRegistration` in the particular JMS Java DSL components
* Fix `Jms` factory to populate the `JmsDefaultListenerContainerSpec`
for the `messageDrivenChannelAdapter()` without class specified

* Refactor AMQP DSL Inbound components to deal with the new ContainerSpec API
* Remove `containerId()` in favor of `id()` in the ContainerSpec
This commit is contained in:
Artem Bilan
2017-05-16 17:33:02 -04:00
committed by Gary Russell
parent 2b99c191f6
commit ea89682368
50 changed files with 396 additions and 267 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,8 +16,8 @@
package org.springframework.integration.ip.dsl;
import java.util.Collection;
import java.util.Collections;
import java.util.Map;
import org.springframework.integration.dsl.ComponentsRegistration;
import org.springframework.integration.dsl.MessageProducerSpec;
@@ -29,6 +29,8 @@ import org.springframework.scheduling.TaskScheduler;
* A {@link MessageProducerSpec} for {@link TcpReceivingChannelAdapter}s.
*
* @author Gary Russell
* @author Artem Bilan
*
* @since 5.0
*
*/
@@ -89,9 +91,10 @@ public class TcpInboundChannelAdapterSpec
}
@Override
public Collection<Object> getComponentsToRegister() {
return this.connectionFactory == null ? Collections.emptyList()
: Collections.singletonList(this.connectionFactory);
public Map<Object, String> getComponentsToRegister() {
return this.connectionFactory != null
? Collections.singletonMap(this.connectionFactory, this.connectionFactory.getComponentName())
: null;
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,8 +16,8 @@
package org.springframework.integration.ip.dsl;
import java.util.Collection;
import java.util.Collections;
import java.util.Map;
import org.springframework.integration.dsl.ComponentsRegistration;
import org.springframework.integration.dsl.MessagingGatewaySpec;
@@ -29,6 +29,8 @@ import org.springframework.scheduling.TaskScheduler;
* A {@link MessagingGatewaySpec} for {@link TcpInboundGateway}s.
*
* @author Gary Russell
* @author Artem Bilan
*
* @since 5.0
*
*/
@@ -88,9 +90,10 @@ public class TcpInboundGatewaySpec extends MessagingGatewaySpec<TcpInboundGatewa
}
@Override
public Collection<Object> getComponentsToRegister() {
return this.connectionFactory == null ? Collections.emptyList()
: Collections.singletonList(this.connectionFactory);
public Map<Object, String> getComponentsToRegister() {
return this.connectionFactory != null
? Collections.singletonMap(this.connectionFactory, this.connectionFactory.getComponentName())
: null;
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,8 +16,8 @@
package org.springframework.integration.ip.dsl;
import java.util.Collection;
import java.util.Collections;
import java.util.Map;
import org.springframework.integration.dsl.ComponentsRegistration;
import org.springframework.integration.dsl.MessageHandlerSpec;
@@ -29,6 +29,8 @@ import org.springframework.scheduling.TaskScheduler;
* A {@link MessageHandlerSpec} for {@link TcpSendingMessageHandler}s.
*
* @author Gary Russell
* @author Artem Bilan
*
* @since 5.0
*
*/
@@ -89,9 +91,10 @@ public class TcpOutboundChannelAdapterSpec
}
@Override
public Collection<Object> getComponentsToRegister() {
return this.connectionFactory == null ? Collections.emptyList()
: Collections.singletonList(this.connectionFactory);
public Map<Object, String> getComponentsToRegister() {
return this.connectionFactory != null
? Collections.singletonMap(this.connectionFactory, this.connectionFactory.getComponentName())
: null;
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,8 +16,8 @@
package org.springframework.integration.ip.dsl;
import java.util.Collection;
import java.util.Collections;
import java.util.Map;
import java.util.function.Function;
import org.springframework.integration.dsl.ComponentsRegistration;
@@ -31,6 +31,8 @@ import org.springframework.messaging.Message;
* A {@link MessageHandlerSpec} for {@link TcpOutboundGateway}s.
*
* @author Gary Russell
* @author Artem Bilan
*
* @since 5.0
*
*/
@@ -88,9 +90,10 @@ public class TcpOutboundGatewaySpec extends MessageHandlerSpec<TcpOutboundGatewa
}
@Override
public Collection<Object> getComponentsToRegister() {
return this.connectionFactory == null ? Collections.emptyList()
: Collections.singletonList(this.connectionFactory);
public Map<Object, String> getComponentsToRegister() {
return this.connectionFactory != null
? Collections.singletonMap(this.connectionFactory, this.connectionFactory.getComponentName())
: null;
}
}