Instead of bean="#xxx", you could use beanClassName="className".
This only works if the bean class does not need to be configured
further using spring.
In such a case, a new bean will be created for each request.
On Mon, Oct 6, 2008 at 12:23 PM, steff aka sid
<[EMAIL PROTECTED]> wrote:
>
> One question only for my understanding. You sayed using bean class directly
> for configuration. What does this mean. Did it mean directly calling the
> bean (by providing a configuration with the URI and the method to use)
> without configuring a bean endpoint (or is in this case the bean not bound)?
> Regards
> /Steffen
>
>
> gnodet wrote:
>>
>> Using servicemix-bean, you can either configure a bean or the bean class.
>> If you configure the bean directly, only that instance will be used to
>> service all requests, whereas if you use the bean class, a new bean
>> will be created for each request.
>>
>> On Mon, Oct 6, 2008 at 9:55 AM, steff aka sid
>> <[EMAIL PROTECTED]> wrote:
>>>
>>> Hi is it possible to have only one instance of an bean component (like a
>>> singleton)? I've created serveral beans but all seem to have two
>>> instances.
>>> In example I've got a init()-Method like:
>>>
>>> @PostConstruct
>>> public void init() throws IOException, MessagingException {
>>> if (null == this.context || null == this.channel) {
>>> throw new IllegalStateException("ClusteringBean
>>> not initialized!");
>>> }
>>>
>>> log.info("ClusteringBean initialized!");
>>> }
>>>
>>> When I deploy this component I get:
>>>
>>> INFO - ClusteringBean - ClusteringBean initialized!
>>> INFO - ClusteringBean - ClusteringBean initialized!
>>>
>>> And even each logging output I create in bean will be printed twice. But
>>> I
>>> only need one instance. The beans are MessageExchangeListeners. Maybe
>>> there
>>> is a better way to create such beans? I've thought about
>>> servicemix-jsr181
>>> component but not sure for that.
>>>
>>> Regards
>>> /steffen
>>>
>>> -----
>>> Brockhaus GmbH
>>> COMPETITIVE THROUGH KNOWLEDGE
>>>
>>> Web: http://www.brockhaus-gruppe.de www.brockhaus-gruppe.de /
>>> http://www.brockhaus-group.com www.brockhaus-group.com
>>> --
>>> View this message in context:
>>> http://www.nabble.com/servicemix-bean-singleton-tp19833428p19833428.html
>>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>>
>> --
>> Cheers,
>> Guillaume Nodet
>> ------------------------
>> Blog: http://gnodet.blogspot.com/
>> ------------------------
>> Open Source SOA
>> http://open.iona.com
>>
>>
>
>
> -----
> Brockhaus GmbH
> COMPETITIVE THROUGH KNOWLEDGE
>
> Web: http://www.brockhaus-gruppe.de www.brockhaus-gruppe.de /
> http://www.brockhaus-group.com www.brockhaus-group.com
> --
> View this message in context:
> http://www.nabble.com/servicemix-bean-singleton-tp19833428p19835299.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>
--
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
Open Source SOA
http://open.iona.com