Sounds like you've discovered a bug in ColdSpring. If it works when
working when you have an additional gateway in the same service.
Hey guys, i'm having a little trouble with a singleton I'm trying to use. I
may not understand how this is intended to work, so I wanted to see if
anyone had any input.
Here is what I'm trying to do:
ColdspringConfig.xml
<beans>
<bean id="ArticleService" class="model.services.ArticleService">
<property name="ArticleGateway"><ref bean="ArticleGateway"
/></property>
<property name="LocationGateway"><ref bean="LocationGateway"
/></property>
</beans>
<bean id="LocationService" class="model.services.LocationService">
<property name="LocationGateway"><ref bean="LocationGateway"
/></property>
</beans>
<bean id="LocationGateway" class="model.gateways.LocationGateway">
<property name="TimedCache"><ref bean="TimedCache" /></property>
</beans>
<bean id="ArticleGateway" class="model.gateways.ArticleGateway">
<property name="TimedCache"><ref bean="TimedCache" /></property>
</beans>
<!-- this is based on the mg:u timed cache -->
<bean id="TimedCache" class="model.utils.TimedCache" singleton="false"
/>
</beans>
So this is what I'm trying to accomplish. I would like to inject an
instance of the TimedCache cfc into each of these gateways. When I do this,
it seems as though there is only one instance of the TimedCache, which they
both seem to be sharing. The TimedCache is stored in the variables scope of
each gateway. Originally I intended for each gateway to get its own
instance, but I can't seem to get this to work. This only seems to happen
if I include both gateways in a single service. Again, each is stored in
the variables scope. If I remove the references to say the locationgateway
from the article service, each TimedCache seems to work as intended. Am I
misunderstand how this should work? Or do I have a programming error?
Thanks for your input!
Andrew