Brian,
 
I noticed that SampleObj accepts "thisVal" as an argument to the constructor, aka init(). Thus in your ColdSpring XML file you would use <constructor-arg> instead of <property> (or add a setThisVal() method to SampleObj). However, I don't think what you posted will *break* ColdSpring - so for kicks, what happens when, instead of a setter method in your MG controller, you add this to your controller's init():
 
<cfset variables.SampleObj = getModelGlue().getConfigBean("SampleObj") />

Reason I ask is that I don't think the autowire stuff is part of the latest release (but I could be wrong).
 
-Dave
 
On 5/4/06, Brian Billings <[EMAIL PROTECTED]> wrote:
All,

I'm trying to get started with CS and its not working as I expect
(with no previous knowledge).

I have a brand new model-glue app template in /CSTEST.

I added beanFactoryLoader and autowireController to modelglue.xml:

<config>
<setting name="beanMappings" value="/CSTEST/config/beans/CSTest.xml" />
<setting name="viewMappings" value="/CSTEST/views" />
<setting name="beanFactoryLoader" value="ModelGlue.Core.ColdSpringLoader" />
<setting name="autowireControllers" value="true" />
<setting name="defaultEvent" value="Home" />
<setting name="reload" value="true" />
<setting name="debug" value="true" />
</config


I added a model object named SampleObj.cfc in /CSTEST/model:

<cfcomponent>
<cffunction name="init">
     <cfargument name="thisVal">
     <cfset variables.thisVal = arguments.thisVal />
     <cfreturn this />
</cffunction>
<cffunction name="getValue">
     <cfreturn variables.thisVal />
</cffunction>
</cfcomponent>


I added a coldspring XML file to /CSTEST/config/beans/ called CSTest.xml:

<beans>
     <bean id="SampleObj" class="CSTEST.model.SampleObj">
             <property name="thisVal">
                     <value>33</value>
             </property>
     </bean>
</beans>

I added a setter to my controller that matched the id in the
coldspring XML file.

<cffunction name="setSampleObj" returntype="void" output="false">
     <cfargument name="SO">
     <cfset variables.SampleObj = arguments.SO />
</cffunction>


The setter in my controller isnt getting called.Im getting the
following error when I try to use SampleObj in the variables scope
from the onRequestStart function:

Element SAMPLEOBJ is undefined in VARIABLES.


Thanks to anyone that can help me get started. Im sure im
misunderstanding something and just need a nudge in the right
direction. Im attaching the whole thing (not much) just in case it is
needed to troubleshoot.



Reply via email to