Skip to content

Implement Lifecycle for IntegrationComponentSpec #2710

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

artembilan
Copy link
Member

Since an IntegrationComponentSpec is a FactoryBean, all it's target
callbacks and lifecycle is controlled over a FactoryBean.

  • Add SmartLifecycle for the IntegrationComponentSpec to delegate
    lifecycle hooks to the target if necessary
  • Refactor IntegrationComponentSpec to be an AbstractFactoryBean
    which is a central place for the FactoryBean, InitializingBean and
    DisposableBean interfaces

Cherry-pick to 5.0.x

See https://stackoverflow.com/questions/54314755/enpointspec-fails-in-spring-integration-java-dsl

Since an `IntegrationComponentSpec` is a `FactoryBean`, all it's target
callbacks and lifecycle is controlled over a `FactoryBean`.

* Add `SmartLifecycle` for the `IntegrationComponentSpec` to delegate
lifecycle hooks to the `target` if necessary
* Refactor `IntegrationComponentSpec` to be an `AbstractFactoryBean`
which is a central place for the `FactoryBean`, `InitializingBean` and
`DisposableBean` interfaces

**Cherry-pick to 5.0.x**
@garyrussell
Copy link
Contributor

I am sure this will work but Specs are just scaffolding for creating integration components; it really doesn't make much sense to register them as beans.

But I guess there's nothing we can do to stop that, so this is probably the only way to go, but I wanted to air my thoughts before merging in case you have anything to add.

@artembilan
Copy link
Member Author

Well, we really can't enforce people do not register them as beans. More over it is there for a while already.
And that is not a way to go in Spring where we definitely connect everything with each other as beans.
Plus this feature is left behind the scene from end user and it becomes just Framework burden to support the proper way of processing.

We may reconsider though in the next version if you feel strong...

@garyrussell garyrussell merged commit 690a2c3 into spring-projects:master Jan 23, 2019
@garyrussell
Copy link
Contributor

No; it's fine; just wanted to air the issue. Cherry-picked as b4a2de1

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.

2 participants