Imagine if Microsoft supported their products like the Coldspring people do. It'd be a different world I tell ya. Thanks David!
Baz -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of David Ross Sent: December 19, 2005 1:26 PM To: [email protected] Subject: Re: [CFCDev] the Coldspring blues Ok, this is all off the top of my head but it should run... it's important to realize that index.cfm doesn't create Main.cfc, ColdSpring creates it (when index.cfm asks the BeanFactory for 'Main'). Application.cfm has some locking code to ensure that only one thread actually creates the BeanFactory (not terribly important but I'm always worried about posting code that leaves out those little details). You could also use Application.cfc's onApplicationStart to do the same. *- coldspring.xml *- <?xml version="1.0" encoding="UTF-8"?> <beans> <bean id="Main" class="path.to.Main"> <property name="Injected"> <ref bean="Injected"/> </property> </bean> <bean id="Injected" class="path.to.Injected"/> </beans> *- Main.cfc *- <cfcomponent> <cfunction name="setInjected" returntype="void" output="false"> <cfargument name="Injected" type="path.to.Injected" required="true"/> <cfset variables.Injected = arguments.Injected /> </cffunction> <!--- Do stuff with variables.Injected.... *-> </cfcomponent> *- Injected.cfc *- <cfcomponent> <!--- Does something... *-> </cfcomponent> *- application.cfm *- <cfif not structKeyExists(application,"beanFactory") or structKeyExists(url,"reloadApp")> <cflock name="Application_Startup" timeout="25"> <cfif not structKeyExists(application,"beanFactory") or structKeyExists(url,"reloadApp")> <cfset application.beanFactory = createObject('component', 'coldspring.beans.DefaultXmlBeanFactory').init()/> <cfset application.beanFactory.loadBeans(expandPath("./coldspring.xml"))/> </cfif> </cflock> </cfif> *-- index.cfm *-- <cfset main = application.beanFactory.getBean('Main')/> <!--- Do something with Main.... *-> Does that help? -Dave >>> [EMAIL PROTECTED] 12/19/2005 7:37:39 AM >>> Maybe I'm just slow, but I've downloaded and tried to use Coldspring atleast 10 times without success. The documentation is even surprisingly good but I just can't seem to implement it in my own apps. Would it be possible for someone to show me an example of the simplest, most basic Coldspring app? The app could consist of the following files: Main.cfc Injected.cfc Application.cfm Index.cfm Coldspring.xml Basically, index.cfm creates Main.cfc which is dependent on injected.cfc. That's it. What would the files contain? Cheers, Baz ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com). An archive of the CFCDev list is available at www.mail-archive.com/[email protected] ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com). An archive of the CFCDev list is available at www.mail-archive.com/[email protected] ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com). An archive of the CFCDev list is available at www.mail-archive.com/[email protected]
