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

@@ -17,9 +17,9 @@
package org.springframework.integration.file.dsl;
import java.io.File;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.Map;
import java.util.function.Function;
import org.springframework.beans.factory.BeanCreationException;
@@ -260,9 +260,9 @@ public class FileInboundChannelAdapterSpec
}
@Override
public Collection<Object> getComponentsToRegister() {
public Map<Object, String> getComponentsToRegister() {
if (this.expressionFileListFilter != null) {
return Collections.singleton(this.expressionFileListFilter);
return Collections.singletonMap(this.expressionFileListFilter, null);
}
else {
return 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.
@@ -17,8 +17,8 @@
package org.springframework.integration.file.dsl;
import java.nio.charset.Charset;
import java.util.Collection;
import java.util.Collections;
import java.util.Map;
import java.util.function.Function;
import org.springframework.expression.common.LiteralExpression;
@@ -228,9 +228,9 @@ public abstract class FileTransferringMessageHandlerSpec<F, S extends FileTransf
}
@Override
public Collection<Object> getComponentsToRegister() {
public Map<Object, String> getComponentsToRegister() {
if (this.defaultFileNameGenerator != null) {
return Collections.singletonList(this.defaultFileNameGenerator);
return Collections.singletonMap(this.defaultFileNameGenerator, null);
}
return null;
}

View File

@@ -17,8 +17,8 @@
package org.springframework.integration.file.dsl;
import java.io.File;
import java.util.Collection;
import java.util.Collections;
import java.util.Map;
import java.util.function.Function;
import org.springframework.expression.Expression;
@@ -261,9 +261,9 @@ public class FileWritingMessageHandlerSpec
}
@Override
public Collection<Object> getComponentsToRegister() {
public Map<Object, String> getComponentsToRegister() {
if (this.defaultFileNameGenerator != null) {
return Collections.singletonList(this.defaultFileNameGenerator);
return Collections.singletonMap(this.defaultFileNameGenerator, null);
}
return null;
}

View File

@@ -17,9 +17,8 @@
package org.springframework.integration.file.dsl;
import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.function.Function;
import org.springframework.expression.Expression;
@@ -234,12 +233,12 @@ public abstract class RemoteFileInboundChannelAdapterSpec<F, S extends RemoteFil
}
@Override
public Collection<Object> getComponentsToRegister() {
List<Object> componentsToRegister = new ArrayList<>();
componentsToRegister.add(this.synchronizer);
public Map<Object, String> getComponentsToRegister() {
Map<Object, String> componentsToRegister = new LinkedHashMap<>();
componentsToRegister.put(this.synchronizer, null);
if (this.expressionFileListFilter != null) {
componentsToRegister.add(this.expressionFileListFilter);
componentsToRegister.put(this.expressionFileListFilter, null);
}
return componentsToRegister;

View File

@@ -17,9 +17,8 @@
package org.springframework.integration.file.dsl;
import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.function.Function;
import org.springframework.expression.Expression;
@@ -340,13 +339,13 @@ public abstract class RemoteFileOutboundGatewaySpec<F, S extends RemoteFileOutbo
}
@Override
public Collection<Object> getComponentsToRegister() {
List<Object> componentsToRegister = new ArrayList<>();
public Map<Object, String> getComponentsToRegister() {
Map<Object, String> componentsToRegister = new LinkedHashMap<>();
if (this.expressionFileListFilter != null) {
componentsToRegister.add(this.expressionFileListFilter);
componentsToRegister.put(this.expressionFileListFilter, null);
}
if (this.mputExpressionFileListFilter != null) {
componentsToRegister.add(this.expressionFileListFilter);
componentsToRegister.put(this.mputExpressionFileListFilter, null);
}
return componentsToRegister;

View File

@@ -16,8 +16,8 @@
package org.springframework.integration.file.dsl;
import java.util.Collection;
import java.util.Collections;
import java.util.Map;
import java.util.function.Function;
import org.springframework.expression.Expression;
@@ -127,9 +127,9 @@ public abstract class RemoteFileStreamingInboundChannelAdapterSpec<F,
}
@Override
public Collection<Object> getComponentsToRegister() {
public Map<Object, String> getComponentsToRegister() {
if (this.expressionFileListFilter != null) {
return Collections.singleton(this.expressionFileListFilter);
return Collections.singletonMap(this.expressionFileListFilter, null);
}
else {
return null;