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 2014-2016 the original author or authors.
* Copyright 2014-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,11 +16,11 @@
package org.springframework.integration.mail.dsl;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.concurrent.Executor;
import java.util.function.Consumer;
@@ -64,7 +64,7 @@ public class ImapIdleChannelAdapterSpec
private final ImapMailReceiver receiver;
private final Collection<Object> componentsToRegister = new ArrayList<Object>();
private final Map<Object, String> componentsToRegister = new LinkedHashMap<>();
private final List<Advice> adviceChain = new LinkedList<>();
@@ -80,7 +80,7 @@ public class ImapIdleChannelAdapterSpec
super(new ImapIdleChannelAdapter(receiver));
this.target.setAdviceChain(this.adviceChain);
this.receiver = receiver;
this.componentsToRegister.add(receiver);
this.componentsToRegister.put(receiver, receiver.getComponentName());
this.externalReceiver = externalReceiver;
}
@@ -326,7 +326,7 @@ public class ImapIdleChannelAdapterSpec
*/
public ImapIdleChannelAdapterSpec transactional() {
TransactionInterceptor transactionInterceptor = new TransactionInterceptorBuilder(false).build();
this.componentsToRegister.add(transactionInterceptor);
this.componentsToRegister.put(transactionInterceptor, null);
return transactional(transactionInterceptor);
}
@@ -352,7 +352,7 @@ public class ImapIdleChannelAdapterSpec
}
@Override
public Collection<Object> getComponentsToRegister() {
public Map<Object, String> getComponentsToRegister() {
return this.componentsToRegister;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2016 the original author or authors.
* Copyright 2014-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.mail.dsl;
import java.util.Collection;
import java.util.Collections;
import java.util.Map;
import java.util.Properties;
import java.util.function.Consumer;
import java.util.function.Function;
@@ -50,7 +50,7 @@ import org.springframework.util.Assert;
* @since 5.0
*/
public abstract class
MailInboundChannelAdapterSpec<S extends MailInboundChannelAdapterSpec<S, R>, R extends AbstractMailReceiver>
MailInboundChannelAdapterSpec<S extends MailInboundChannelAdapterSpec<S, R>, R extends AbstractMailReceiver>
extends MessageSourceSpec<S, MailReceivingMessageSource>
implements ComponentsRegistration {
@@ -253,8 +253,8 @@ public abstract class
}
@Override
public Collection<Object> getComponentsToRegister() {
return Collections.<Object>singletonList(this.receiver);
public Map<Object, String> getComponentsToRegister() {
return Collections.singletonMap(this.receiver, this.receiver.getComponentName());
}
@Override