From inside my BusinessUnit Service I want to be able to call the coldspring factory, and I would like
the coldspring factory to be provided to as a constructor-arg to the BusinessUnit service.
In mach-ii they manually retrieve the coldspring factory like this:
<cffunction name="configure" access="public" returntype="void" output="false">
<cfset var sf = getProperty('serviceFactory')/>
<cfset variables.m_categoryService = sf.getBean('categoryService')/>
</cffunction>
But I don't see why I can't have coldspring pass itself into my BusinessUnit Service.
On 3/9/06, Chris Scott <[EMAIL PROTECTED]> wrote:
Paul, I'm not sure if you're missing the point, ColdSpring will
automatically provide managed CFCs with there dependencies, via
setter methods or constructor args. Just register the two components
and tell it you want the BusinessUnitDGO component to be provided to
the BusinessUnit component:
-services.xml
<bean id="businessUnitDGO" class="BusinessUnitDGO" />
<bean id="businessUnit" class="BusinessUnit">
<constructor-arg name="businessUnitDGO">
<ref bean="businessUnitDGO" />
</constructor-arg>
</bean>
OR
-services.xml
<bean id="businessUnitDGO" class="BusinessUnitDGO" />
<bean id="businessUnit" class="BusinessUnit">
<property name="businessUnitDGO">
<ref bean="businessUnitDGO" />
</property>
</bean>
On Mar 9, 2006, at 3:40 PM, Peter J. Farrell wrote:
> Paul Roe said the following on 3/9/2006 2:04 PM:
>> sorry I wasn't clear, I want the csFactory to be the actual
>> coldspring
>> factory object that will be using the xml file
>>
>> so when I create the factory:
>> <cfset application.csFactory = createObject("component","
>> SCAR.coldspring.beans.DefaultXmlBeanFactory").init() />
>>
>> I want this application.csFactory object to be passed into some of
>> the services that it will create.
> I don't know if that's the best idea. Why can't you let CS inject the
> required dependencies into your factory?
>
> .Peter
>
> --
> Peter J. Farrell :: Maestro Publishing
> Member Team Mach-II :: Member Team Fusion
> http://blog.maestropublishing.com
>
> Create boilerplate beans and transfer objects for ColdFusion!
> Fire up a cup of Rooibos!
> http://rooibos.maestropublishing.com/
>
>
>
