This is my first attempt to do any "manual" dependency injection using bean definitions within coldspring.xml, and I just can't get it to work.

The scenario:
Using MGU, latest code. I have two controllers - ProductController and WizardController, both residing in the "controllers" directory off of the app root. I want to inject, as a constructor argument, ProductController into WizardController.

coldspring.xml snippet
    <bean id="productcontroller" class="controller.productcontroller" />
   
    <bean id="wizcontroller" class="controller.wizardcontroller ">
        <constructor-arg name="PController">
            <ref bean="productcontroller" />
        </constructor-arg>
    </bean>

Init method of WizardController:
    <CFFUNCTION name="init" returntype="controller.wizardcontroller" output="false" access="public">
        <cfargument name="PController" type="controller.productcontroller " required="true" hint="Dependency product controller"/>   
            <cfset variables.prodcontroller = arguments.PController/>       
            <CFRETURN this />
    </CFFUNCTION>


The Symptoms:

I receive the error whenever the wizardcontroller is instantiated:

The argument PCONTROLLER passed to function init() is not of type controller.productcontroller.


On an interesting side note, if i change the type argument to "Any", i get no error, but the object that gets injected into the PController variable is 
ModelGlue.unity.framework.ModelGlue

How's THAT for strange!

Can anybody see what I'm doing wrong?


Reply via email to