Fusebox ColdSpring Lexicon Mod

For those using the "traditional" XML flavor of Fusebox, starting with Fusebox 5.1 the skeleton application includes a lexicon that makes working with ColdSpring a breeze. The only problem with this lexicon is that there is no way to use a ColdSpring bean factory that lives outside of the Fusebox application context. This becomes a problem when you want to use ColdSpring remote proxies for AJAX or Flex, as those requests may not have access to the Fusebox application context. To get around this issue I modified the lexicon's initialize tag to support a parent bean factory. Now you can do something like this:

<cs:initialize
coldspringfactory="servicefactory"
parentbeanfactory="application.mySharedBeanFactory" />

which will cause the following to be written to your parsed files:

<cfset myFusebox.getApplication().getApplicationData().servicefactory = createObject("component", "coldspring.beans.DefaultXmlBeanFactory").init( defaultProperties="#structnew()#" )/>
<cfset myFusebox.getApplication().getApplicationData().servicefactory.setParent( application.mySharedBeanFactory) />

This approach is very similar to what ModelGlue does with it's ModelGlue_PARENT_BEAN_FACTORY setting.

If you are interested I've attached the modified initialize.cfm to this post. I've also posted this mod to the Fusebox 5 group to see if there is any interest in making this change in the release version.

Comments
BlogCFC was created by Raymond Camden. This blog is running version 5.8.001.