Coldspring aleays gives med singleton object even if I use the
singleton="false" attributes. Why?
--
You received this message because you are subscribed to the Google Groups "ColdSpring-Users" group.
To post to this group, send email to coldspri...@googlegroups.com.
To unsubscribe from this group, send email to coldspring-use...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/coldspring-users?hl=en.
<beans>
<bean id="ErrorCollection" class="DropBox.dmc.message.errorcollection"
singleton="false"/>
<bean id="SvefakturaV1p0HogiaValistractor"
class="DropBox.dmc.message.SvefakturaV1p0HogiaValistractor"
singelton="false">
<constructor-arg name="errorCollectionObject">
<ref bean="ErrorCollection"/>
</constructor-arg>
</bean>
<bean id="ValidateOrgNrNo" class="DropBox.dmc.message.ValidateOrgNrNo"/>
<bean id="SvefakturaV1p0Message" class="DropBox.dmc.message.Message"
singleton="false">
<constructor-arg name="dropboxCompanyId">
<value>2</value>
</constructor-arg>
<constructor-arg name="OrgNrValidator">
<ref bean="ValidateOrgNrNo"/>
</constructor-arg>
<constructor-arg name="Valistractor">
<ref bean="SvefakturaV1p0Hogia"/>
</constructor-arg>
</bean>
</beans>
coldspring-use...@googlegroups.com<coldspring-users%2Bunsu...@googlegroups.com>
To unsubscribe from this group, send email to coldspring-use...@googlegroups.com.
The following configuration works fine
<bean id="SvefakturaV1p0Valistractor"
class="DropBox.dmc.message.SvefakturaV1p0Valistractor" singleton="false">
<constructor-arg name="errorCollectionObject">
<ref bean="ErrorCollection" />
</constructor-arg>
</bean>
But if I inject a logging service, the object starts acting as a
singleton.
<bean id="SvefakturaV1p0ValistractorTarget"
class="DropBox.dmc.message.SvefakturaV1p0Valistractor" singleton="false">
<constructor-arg name="errorCollectionObject">
<ref bean="ErrorCollection" />
</constructor-arg>
</bean>
<bean id="SvefakturaV1p0Valistractor"
class="coldspring.aop.framework.ProxyFactoryBean">
<property name="target">
<ref bean="SvefakturaV1p0ValistractorTarget" />
</property>
<property name="interceptorNames">
<list>
<value>loggingAdvisor</value>
</list>
</property>
</bean>
On Mon, 8 Mar 2010 23:39:58 +1100, Kevan Stannard
<kevans...@gmail.com>
wrote:
> Looks like you have a typo for your SvefakturaV1p0HogiaValistractor
bean:
>
> <bean
> id="SvefakturaV1p0HogiaValistractor"
> class="DropBox.dmc.message.SvefakturaV1p0HogiaValistractor"
> *singelton*="false">
>
> Should be
>
> <bean
> id="SvefakturaV1p0HogiaValistractor"
> class="DropBox.dmc.message.SvefakturaV1p0HogiaValistractor"
> *singleton*="false">
<coldspring-users%2Bunsu...@googlegroups.com<coldspring-users%252Buns...@googlegroups.com>
But I still don't understand why I don't get a non-singleton as soon as I
inject a logging service when I define the bean as
<bean id="SvefakturaV1p0ValistractorTarget"
class="DropBox.dmc.message.SvefakturaV1p0Valistractor" singleton="false">
<constructor-arg name="errorCollectionObject">
<ref bean="ErrorCollection" />
</constructor-arg>
</bean>
<bean id="SvefakturaV1p0Valistractor"
class="coldspring.aop.framework.ProxyFactoryBean">
<property name="target">
<ref bean="SvefakturaV1p0ValistractorTarget" />
</property>
<property name="interceptorNames">
<list>
<value>loggingAdvisor</value>
</list>
</property>
</bean>
Why does injecting a loggingadvisor break my non-singleton object?
This works as a charm and gives me a non-singleton
<bean id="SvefakturaV1p0Valistractor"
class="DropBox.dmc.message.SvefakturaV1p0Valistractor" singleton="false">
<constructor-arg name="errorCollectionObject">
<ref bean="ErrorCollection" />
</constructor-arg>
</bean>
Cheers,
Olav
On Mon, 8 Mar 2010 11:59:17 -0500, Dennis Clark <boom...@gmail.com>
wrote:
> Your SvefakturaV1p0Valistractor bean is a singleton. If you inject a
> singleton bean with a property bean, the singleton bean gets only one
> instance of the property bean even if that property bean is defined as
> singleton="false".
>
> You can see this for yourself by defining a second proxy bean and
injecting
> the same <ref bean="SvefakturaV1p0ValistractorTarget" /> into it. If you
> change the state of the target object in the second bean, the target
object
> of the first proxy bean will not be affected because they are different
> instances. However the target object instance assigned to each proxy
bean
> will remain the same for the lifetime of the ColdSpring bean factory.
>
> It looks like you are trying to apply ColdSpring AOP to transient
objects.
> You *might* be able to get this to work by using singleton="false" on
> SvefakturaV1p0Valistractor,
> but even if this works instantiating each object is going to be
incredibly
> slow as the dependency resolution that Brian mentioned would occur
> *twice*for each call to getBean("
But I'm trying to find out if it's possible to inject a loggingadvisor
into a non-singleton object, and still expect the returned proxy to be a
non-singleton? If this should be possible, either my setup is wrong (most
likely) or there might be a bug related to the ProxyFactoryBean returning
non-singleton objects.
Cheers,
Olav
--
You received this message because you are subscribed to the Google Groups "ColdSpring-Users" group.
To post to this group, send email to coldspri...@googlegroups.com.
To unsubscribe from this group, send email to coldspring-use...@googlegroups.com.
On Mon, Mar 8, 2010 at 4:44 PM, <ol...@ansit.no> wrote:
> <bean id="SvefakturaV1p0Valistractor"
> class="coldspring.aop.framework.ProxyFactoryBean">
This defines a singleton. You want SvefakturaV1p0Valistractor to be a
transient so you need singleton="false" here as Brian suggested.
Did that work?
--
Sean A Corfield -- (904) 302-SEAN
Railo Technologies US -- http://getrailo.com/
An Architect's View -- http://corfield.org/
"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood