cinqS
cinqS

Reputation: 1223

Spring Integration, Service activator, create only one instance when called by multiple messages

I am run across a case that:

If there are multiple messages coming for the upstream of the service-activator, so, only one bean, or class, will be instantiated? right?

Or the bean in service-activator will be instantiated every time a message comes?

Thx

For example, I have a service-activator like this:

<int:service-activator input-channel="input" method="trans" output-channel="output">
    <bean class="com.example.eurowp.Transformer" init-method="onInit" destroy-method="onDestroy">
    </bean>
</int:service-activator>

Upvotes: 0

Views: 497

Answers (1)

Gary Russell
Gary Russell

Reputation: 174554

There is just one instance - the object (bean) is created during context initialization, not at runtime.

If running in a multi-threaded environment, the class must be thread-safe.

Upvotes: 1

Related Questions