<alias name="transferFactory" alias="ormService"/>
So why did I think this wouldn't work?
I created a test case for parent / child bean factories and aliases, I put nothing but aliases in the child factories. ColdSpring couldn't find the aliases. I deduced (wrongly) that ColdSpring did not allow aliases in child factories to redefine beans in the parent factory.
Silly me. Turns out that my test case uncovered a bug in ColdSpring: aliases only work if the factory contains at least one real bean. At least, that's what my test cases seem to show. I'm going to run this past the ColdSpring crew for confirmation.
Want to share a single instance of Transfer between multiple Model-Glue applications? Original code / post edited out. The definition of transferFactory is in your parent bean factory which you tell Model-Glue about by putting this line in your index.cfm:
<cfset ModelGlue_PARENT_BEAN_FACTORY = application.cs />
(assuming your overall Application.cfc is creating application.cs).
All the Model-Glue apps share that Application.cfc and so they all have the same parent bean factory which contains the single instance of the Transfer factory object. Each Model-Glue app has

6 responses so far ↓
1 Robb // Jan 10, 2007 at 6:39 PM
Robb
2 John Allen // Jan 10, 2007 at 8:34 PM
3 Ken Dunnington // Jan 11, 2007 at 12:10 PM
4 Joe Rinehart // Jan 12, 2007 at 4:55 AM
Why not use a ColdSpring alias to point the alias "ormService" to the true (not proxy) Transfer in your parent bean factory, e.g.,
<alias alias="ormService" name="nameOfTransferBeanInParentFactory" />
?
5 Sean Corfield // Jan 13, 2007 at 12:06 AM
Aliases only work within a single bean factory instance. You can't create an alias in a bean factory that references a bean in the parent bean factory.
Now, as to whether or not it *should* work... I'll leave that up to Chris and Dave...
6 Sean Corfield // Feb 8, 2007 at 9:19 PM
Turns out my test case uncovers a bug in ColdSpring - if you have a factory that contains *only* <alias> tags, ColdSpring won't find any of them. You have to have at least one real <bean> in a factory for <alias> to work.
So this whole proxy thing is actually bogus. You can just <alias name="transferFactory" alias="ormService"/>
Leave a Comment