INT-4480: Use component type for ids in the flow (#2536)

* INT-4480: Use component type for ids in the flow

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

For better readability of bean names, e.g. from the metrics collectors,
generate them from the component type instead of their fully qualified
class names

* * Fix bean name for injection in the WebFluxDslTests
This commit is contained in:
Artem Bilan
2018-08-09 15:01:41 -04:00
committed by Gary Russell
parent 055e9a40db
commit 26229c9862
5 changed files with 23 additions and 5 deletions

View File

@@ -429,7 +429,14 @@ public class IntegrationFlowBeanPostProcessor
: fallbackId;
}
String generatedBeanName = prefix + instance.getClass().getName();
String generatedBeanName = prefix;
if (instance instanceof NamedComponent) {
generatedBeanName += ((NamedComponent) instance).getComponentType();
}
else {
generatedBeanName += instance.getClass().getName();
}
String id = generatedBeanName;
int counter = -1;
while (counter == -1 || this.beanFactory.containsBean(id)) {

View File

@@ -289,6 +289,9 @@ public class IntegrationFlowTests {
@Test
public void testLambdas() {
assertTrue(this.beanFactory.containsBean("lambdasFlow.filter#0"));
assertTrue(this.beanFactory.containsBean("lambdasFlow.transformer#0"));
QueueChannel replyChannel = new QueueChannel();
Message<?> message = MessageBuilder.withPayload("World")
.setHeader(MessageHeaders.REPLY_CHANNEL, replyChannel)