By default anything you get from coldspring will be a singleton so long
as coldspring is stored in a persistent scope. So if coldspring is in
application scope, then getBean("whatever") will be a singleton. But for
brevity or just to make sure you could just store it yourself, but
you'll want to control access to it to make it a real singleton.


-----Original Message-----
From: [email protected]
[mailto:[EMAIL PROTECTED] On Behalf Of Mike Kear
Sent: Sunday, November 25, 2007 5:05 PM
To: [email protected]
Subject: [coldspring-dev] Getting singletons instantiated

I am really enjoying the way coldspring has taken care of a lot of the
details of getting components instantiated correctly. 

My habit in the past has been ot instantiate all the components a page
requires at the top of the page, which of course is not the best way to
do
things.  As you've advised me here, my fear that putting CFCs into
shared
scopes would end up filling the RAM in a shared host  is unfounded. 

But how to instantiate a cfc as a singleton? 

Should I do this in the application.cfc onApplicationStart() method?

<cfset
application.catalogDAO=application.beanfactory.getBean("catalogDAO")
/>

Or is there a coldspring-automated way of doing it?

Cheers
Mike Kear
Windsor, NSW, Australia
0422 985 585
Adobe Certified Advanced ColdFusion Developer
AFP Webworks Pty Ltd
http://afpwebworks.com
Full Scale ColdFusion hosting from A$15/month






Reply via email to