Holly,
In the perfect world you'd use a named bean factory. (see Colspring.util.BeanFactoryUtils) That way you could easily use the same bean factory in MG as in other locations. Unfortunately, MG doesn't yet support that.
This is a hack I've done to get ahold of the bean factory that MG uses for use with other services. It's not elegant and provides a dependency on Model-Glue (and that MG be loaded), but it gets the job done.
<!--- get the beanfactory. Note, I don't like that this has to be aware of Model-Glue, but MG
is not aware of named beanfactories so we need to get it from MG to avoid all sorts of hassles --->
<cftry>
<cfset variables.BeanFactory = application.root.framework.getBeanFactory() />
<cfcatch>
<cfthrow message="Before the RemoteListService can be used the application must first be loaded." detail="The RemoteListService depends on data loaded by the Model-Glue framework. This framework is not currently loaded so we can't access that data." type="
Lists.model.service.RemoteListService" />
</cfcatch>
</cftry>
I've volunteered to add named bean factories to MG, but I simply haven't taken the time to figure out the best way to do this in a backwards compatible manner.
Doug
On 5/10/07, Holly Jones <h_jones2001@...> wrote:
I've written a MG:Unity app and am using ColdSpring. I'd like to build
a Flex front-end using the same model.
Since MG takes care of calling ColdSpring.xml, which handles my DI, I'm
a little confused how to call functions in my model from Flex.
--
Doug Hughes