GH-3923: Add @MessagingGateway @Import support (#3929)

* GH-3923: Add @MessagingGateway @Import support

Fixes https://github.com/spring-projects/spring-integration/issues/3923

Currently, the `@MessagingGateway` interfaces can be scanned or created
explicitly as `@Bean` definition for `AnnotationGatewayProxyFactoryBean`

* Implement a `GatewayProxyBeanDefinitionPostProcessor` which is invoked
before instantiation attempt on the `BeanDefinition`
* Verify `@Import` for `@MessagingGateway` interface in the `GatewayInterfaceTests`

* Remove supplier for `GatewayProxyInstantiationPostProcessor` bean definition

Co-authored-by: Gary Russell <grussell@vmware.com>

* * Fix bean definition signature

Co-authored-by: Gary Russell <grussell@vmware.com>
This commit is contained in:
Artem Bilan
2022-10-31 10:32:52 -04:00
committed by GitHub
parent 532692b0ec
commit 511cb7619b
5 changed files with 122 additions and 0 deletions

View File

@@ -319,6 +319,9 @@ Along with the `@MessagingGateway` annotation you can mark a service interface w
Starting with version 6.0, an interface with the `@MessagingGateway` can also be marked with a `@Primary` annotation for respective configuration logic as its possible with any Spring `@Component` definition.
Starting with version 6.0, `@MessagingGateway` interfaces can be used in the standard Spring `@Import` configuration.
This may be used as an alternative to the `@IntegrationComponentScan` or manual `AnnotationGatewayProxyFactoryBean` bean definitions.
NOTE: If you have no XML configuration, the `@EnableIntegration` annotation is required on at least one `@Configuration` class.
See <<./overview.adoc#configuration-enable-integration,Configuration and `@EnableIntegration`>> for more information.

View File

@@ -114,6 +114,8 @@ The Messaging Gateway interface method can now return `Future<Void>` and `Mono<V
Alongside with a `@MessagingGateway` annotation the interface can also be marked with a `@Primary`.
`@MessagingGateway` interfaces can now be `@Import`ed into a configuration.
See <<./gateway.adoc#gateway, Messaging Gateway>> for more information.
The `integrationGlobalProperties` bean is now declared by the framework as an instance of `org.springframework.integration.context.IntegrationProperties` instead of the previously deprecated `java.util.Properties`.