On 4/5/06, Matt Williams <[EMAIL PROTECTED]> wrote:
> I am able to duplicate Brian's issue using stable release 0.5. If I use
> constructor-arg to pass a bean, and have a private setter for that bean, it
> throws the error saying "The method 'setPersonGateway' could not be found in
> component".
OK, I have a small test case that shows that if ColdSpring is told to
run a constructor and also finds that there is a public setter, it
calls the setter *as well*.
Here's the example:
=== test/cs/Application.cfc ===
<cfcomponent>
<cfset this.name = "cs_tests" />
</cfcomponent>
=== test/cs/cs.xml ===
<beans>
<bean id="stuff" class="test.cs.stuff">
<constructor-arg name="something">
<ref bean="thing" />
</constructor-arg>
</bean>
<bean id="thing" class="test.cs.thing" />
</beans>
=== test/cs/index.cfm ===
<cfset cs =
createObject("component","coldspring.beans.DefaultXmlBeanFactory").init()
/>
<cfset cs.loadBeans(expandPath("cs.xml")) />
<cfset stuff = cs.getBean("stuff") />
<cfoutput>
<p>#stuff.getLog()#</p>
</cfoutput>
=== test/cs/stuff.cfc ===
<cfcomponent>
<cfset variables.log = arrayNew(1) />
<cffunction name="init" returntype="stuff" access="public"
output="false">
<cfargument name="something" type="thing" required="true" />
<cfset arrayAppend(variables.log,"init() called") />
<cfreturn this />
</cffunction>
<cffunction name="setThing" returntype="void" access="public"
output="false">
<cfargument name="thing" type="thing" required="true" />
<cfset arrayAppend(variables.log,"setThing() called") />
<cfset variables.thing = arguments.thing />
</cffunction>
<cffunction name="getLog" returntype="string" access="public"
output="false">
<cfreturn arrayToList(variables.log) />
</cffunction>
</cfcomponent>
=== test/cs/thing.cfc ===
<cfcomponent>
</cfcomponent>
--
Sean A Corfield -- http://corfield.org/
Got frameworks?
"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood