I'm using Camel's spring DSL to build routes and I'm using my POJO bean as a processor.
Initially, I as doing:
<bean ref="myPojoBeanProcessor"/>
where, 'myPojoBeanProcessor' was defined as a bean in my spring context.
Then, I switched to:
<bean beanType="com.mycompany.transformation.MyPojoBeanProcessor"/>
The Java DSL equivalent would be, I think:
from("xxx").bean(MyPojoBeanProcessor.class).xxx
I'm wondering if with the later approach, a bean object would be instantiated with every request or would the bean instance be cached and used as a singleton (like the default in spring).
I was unable to find an answer in the camel documentation or on google. Does anyone know the answer to this question?
Why don't you just try it out :)
Camel will create an instance one time using the default no-arg constructor, and cache the instance, eg its singleton scoped.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With