Hm ok, but do you have an example for that? I currently configure my bean using xbean configuration file like the following:
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:bean="http://servicemix.apache.org/bean/1.0" xmlns:brockhaus="http://brockhaus-gruppe.de/services/category" xmlns:xsi="http://http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://servicemix.apache.org/bean/1.0 http://servicemix.apache.org/schema/servicemix-bean-3.2.2.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"> <bean:endpoint service="brockhaus:categoryClusteringBean" endpoint="endpoint" bean="#ClusteringBean"/> <bean id="ClusteringBean" class="de.brockhaus-gruppe.beans.ClusteringBean"/> </beans> 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-tp19833428p19833614.html Sent from the ServiceMix - User mailing list archive at Nabble.com.
