Reputation: 2431
Lets say I want to create a stream with this defintion
file | serviceActivator1 | transform | serviceActivator2
So I have two custom modules in this definition. My understanding is that spring xd will create a child context of each component/module and deploy it in a container.
How can I share a single bean across serviceActivator1 and serviceActivator2. Basically this bean should be defined in the parent context, not the child context of each module.
Upvotes: 2
Views: 316
Reputation: 174554
See How to Add a Spring bean to the XD Container. Bear in mind that the modules will only see the same bean instance if they are running in the same container.
You would also need a custom plugin to make the bean available to the modules.
However, it is generally better to share state between modules using message headers.
Upvotes: 1