|
48 | 48 | import org.springframework.beans.factory.annotation.Autowired;
|
49 | 49 | import org.springframework.beans.factory.annotation.Qualifier;
|
50 | 50 | import org.springframework.beans.factory.config.AbstractFactoryBean;
|
| 51 | +import org.springframework.beans.factory.config.BeanDefinition; |
51 | 52 | import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
| 53 | +import org.springframework.beans.factory.support.AbstractBeanDefinition; |
| 54 | +import org.springframework.beans.factory.support.BeanDefinitionRegistry; |
52 | 55 | import org.springframework.context.ApplicationContext;
|
53 | 56 | import org.springframework.context.Lifecycle;
|
54 | 57 | import org.springframework.context.SmartLifecycle;
|
|
64 | 67 | import org.springframework.context.expression.EnvironmentAccessor;
|
65 | 68 | import org.springframework.context.expression.MapAccessor;
|
66 | 69 | import org.springframework.core.annotation.AliasFor;
|
| 70 | +import org.springframework.core.annotation.AnnotatedElementUtils; |
67 | 71 | import org.springframework.core.convert.converter.Converter;
|
68 | 72 | import org.springframework.core.log.LogAccessor;
|
69 | 73 | import org.springframework.core.serializer.support.SerializingConverter;
|
|
79 | 83 | import org.springframework.integration.annotation.GatewayHeader;
|
80 | 84 | import org.springframework.integration.annotation.InboundChannelAdapter;
|
81 | 85 | import org.springframework.integration.annotation.IntegrationComponentScan;
|
| 86 | +import org.springframework.integration.annotation.MessageEndpoint; |
82 | 87 | import org.springframework.integration.annotation.MessagingGateway;
|
83 | 88 | import org.springframework.integration.annotation.Poller;
|
84 | 89 | import org.springframework.integration.annotation.Publisher;
|
|
143 | 148 | import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
|
144 | 149 | import org.springframework.util.ClassUtils;
|
145 | 150 | import org.springframework.util.MultiValueMap;
|
| 151 | +import org.springframework.util.StringUtils; |
146 | 152 |
|
147 | 153 | import reactor.core.publisher.Flux;
|
148 | 154 | import reactor.core.publisher.Mono;
|
@@ -488,6 +494,10 @@ public void testChangePatterns() {
|
488 | 494 |
|
489 | 495 | @Test
|
490 | 496 | public void testMessagingGateway() throws InterruptedException {
|
| 497 | + String gatewayBeanName = AnnotatedElementUtils.findMergedAnnotation(TestGateway.class, Component.class).value(); |
| 498 | + assertThat(gatewayBeanName).isEqualTo("namedTestGateway"); |
| 499 | + assertThat(this.testGateway).isSameAs(this.context.getBean(gatewayBeanName)); |
| 500 | + |
491 | 501 | String payload = "bar";
|
492 | 502 | String result = this.testGateway.echo(payload);
|
493 | 503 | assertThat(result.substring(0, payload.length())).isEqualTo(payload.toUpperCase());
|
@@ -1464,7 +1474,7 @@ public interface ConditionalGateway {
|
1464 | 1474 |
|
1465 | 1475 | }
|
1466 | 1476 |
|
1467 |
| - @TestMessagingGateway |
| 1477 | + @TestMessagingGateway(name = "namedTestGateway") |
1468 | 1478 | public interface TestGateway {
|
1469 | 1479 |
|
1470 | 1480 | @Gateway(headers = @GatewayHeader(name = "calledMethod", expression = "method.name"))
|
@@ -1494,6 +1504,9 @@ public interface TestGateway2 {
|
1494 | 1504 | defaultHeaders = @GatewayHeader(name = "foo", value = "FOO"))
|
1495 | 1505 | public @interface TestMessagingGateway {
|
1496 | 1506 |
|
| 1507 | + @AliasFor(annotation = MessagingGateway.class) |
| 1508 | + String name() default ""; |
| 1509 | + |
1497 | 1510 | @AliasFor(annotation = MessagingGateway.class, attribute = "defaultRequestChannel")
|
1498 | 1511 | String defaultRequestChannel() default "";
|
1499 | 1512 |
|
|
0 commit comments