Skip to content

Conversation

artembilan
Copy link
Member

Fixes #8586

The IntegrationComponentSpec is not a plain wrapper around single component. Sometimes it comes with several components where all of them must be registered as beans.
If IntegrationComponentSpec.get() is called from end-user code, we may lose other related components, for example filters in the FileInboundChannelAdapterSpec.

  • Deprecate IntegrationComponentSpec.get() with no-op for end-user, rather encourage to leave it as is and let the framework take care about its lifecycle and related components registration
  • Fix IntegrationComponentSpec logic to deal as a simple FactoryBean instead of extra overhead via AbstractFactoryBean
  • Use IntegrationComponentSpec.getObject() in the framework code where get() was called
  • Fix tests to expose IntegrationComponentSpec as beans instead of previously called get()
  • Some other clean up and typos fixes in the affected classes
  • Document the change

Fixes spring-projects#8586

The `IntegrationComponentSpec` is not a plain wrapper around single component.
Sometimes it comes with several components where all of them must be registered
as beans.
If `IntegrationComponentSpec.get()` is called from end-user code, we may lose
other related components, for example filters in the `FileInboundChannelAdapterSpec`.

* Deprecate `IntegrationComponentSpec.get()` with no-op for end-user,
rather encourage to leave it as is and let the framework take care about its lifecycle
and related components registration
* Fix `IntegrationComponentSpec` logic to deal as a simple `FactoryBean` instead of
extra overhead via `AbstractFactoryBean`
* Use `IntegrationComponentSpec.getObject()` in the framework code where `get()` was called
* Fix tests to expose `IntegrationComponentSpec` as beans instead of previously called `get()`
* Some other clean up and typos fixes in the affected classes
* Document the change
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.

Just one comment, and some doc polishing.

@garyrussell garyrussell merged commit b997295 into spring-projects:main Apr 13, 2023
@artembilan artembilan deleted the GH-8586 branch April 13, 2023 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Revise the IntegrationComponentSpec.get() API to disallow to be called from end-user code

2 participants