Skip to content

Conversation

artembilan
Copy link
Member

Related to #3923

When gateway proxy is declared manually, a GatewayProxyFactoryBean is used as a @Bean. In this case the info about target interface is not available on a BeanDefinition, unlike with a programmatic registration via MessagingGatewayRegistrar.

  • Expose <T> on a GatewayProxyFactoryBean to make end-user to specify the type this gateway is going to be based on.
    This allows Spring container to determine the type of the FactoryBean bean definition properly
  • Migrate a programmatic bean definition registration from the FactoryBean.OBJECT_TYPE_ATTRIBUTE to the targetType property of the BeanDefinition based on a ResolvableType.forClassWithGenerics() to simulate generic arg for the application context
  • Remove ComponentsRegistration from the GatewayProxySpec since it us out of use
  • Fix affected tests for newly added generic arg on the GatewayProxyFactoryBean

Related to spring-projects#3923

When gateway proxy is declared manually, a `GatewayProxyFactoryBean` is used as a `@Bean`.
In this case the info about target interface is not available on a `BeanDefinition`,
unlike with a programmatic registration via `MessagingGatewayRegistrar`.

* Expose `<T>` on a `GatewayProxyFactoryBean` to make end-user to specify the type
this gateway is going to be based on.
This allows Spring container to determine the type of the `FactoryBean` bean definition
properly
* Migrate a programmatic bean definition registration from the
`FactoryBean.OBJECT_TYPE_ATTRIBUTE` to the `targetType` property
of the `BeanDefinition` based on a `ResolvableType.forClassWithGenerics()`
to simulate generic arg for the application context
* Remove `ComponentsRegistration` from the `GatewayProxySpec` since it us out of use
* Fix affected tests for newly added generic arg on the `GatewayProxyFactoryBean`
@artembilan
Copy link
Member Author

Even if this looks like a breaking change, it is still legit for the current major release.
Plus it is really long overdue for this generic feature required by the FactoryBean contract.
With this fix the change in the #3904 would make sense and probably will generate the proper AOT code - already with a generic argument on the GatewayProxyFactoryBean bean definition 😄

Copy link
Contributor

@garyrussell garyrussell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo

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

chrylis commented Oct 25, 2022

This definitely looks helpful for a number of cases!

@garyrussell garyrussell merged commit e52e352 into spring-projects:main Oct 25, 2022
@artembilan artembilan modified the milestones: 6.0 GA, 6.0.0-RC2 Nov 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants