Thanks Chris - that was what I was looking for.
-- Jeff From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Chris Scott Sent: Thursday, June 21, 2007 8:44 PM To: [email protected] Subject: [coldspring-dev] Inject ColdSpring Factory Into an Object? This is called making a bean 'BeanFactoryAware'. In Spring, you would do this byimplementing the BeanFactoryAware interface, as you will do in the CF8 version of ColdSpring. For the current version, we have taken a duck-typing approach, so all you need to do is add this method: <cffunction name="setBeanFactory" returntype="void" access="public" output="false"> <cfargument name="bf" type="coldspring.beans.BeanFactory" required="true" /> <cfset variables.bf = bf /> </cffunction> to your bean, and it will automatically have the BeandFactory injected in it. Obviously, you can store the BeanFactory in whatever variable you would like. Chris Chris Scott [EMAIL PROTECTED] http://cdscott.blogspot.com/ http://www.coldspringframework.org/ On Jun 21, 2007, at 2:07 PM, Jeff Chastain wrote: Is it possible to inject the ColdSpring bean factory itself into an object? I think I have seen this before, but I want to check and find out the proper syntax. To head off the questions, I know the point of dependency injection is to inject any dependent objects into the parent object without the parent object knowing about factories etc. However, in the case I am working on, the parent object does not know its dependencies before run-time. In other words, the parent object has an API that can be programmatically used and in some cases will introduce new dependencies. Therefore, I need the parent object to have the generic concept of a factory that it can use to load these dependent objects at run time. Thanks -- Jeff
<<image001.gif>>
