<bean id="reactorFactory" class="reactor.reactorFactory">
<constructor-arg name="configuration">
<value>/ggcc10/config/reactor.xml</value>
</constructor-arg>
</bean>
<bean id="taskGateway" factory-bean="reactorFactory"
factory-method="createGateway">
<constructor-arg name="objectAlias">
<value>task</value>
</constructor-arg>
</bean>
Kurt Wiersma recently updated ColdSpring so you can define a factory and specify that other beans are obtained from that factory instead of directly from ColdSpring.
In the ModelGlue.xml file, specify the ColdSpring loader and that you want autowiring:
<constructor-arg name="configuration">
<value>/ggcc10/config/reactor.xml</value>
</constructor-arg>
</bean>
<bean id="taskGateway" factory-bean="reactorFactory"
factory-method="createGateway">
<constructor-arg name="objectAlias">
<value>task</value>
</constructor-arg>
</bean>
<setting name="beanFactoryLoader"
value="ModelGlue.Core.ColdSpringLoader" />
<setting name="autowireControllers" value="true" />
Finally the controller has a setter for the task gateway:
value="ModelGlue.Core.ColdSpringLoader" />
<setting name="autowireControllers" value="true" />
<cffunction name="setTaskGateway" returntype="void" access="public" output="false">
<cfargument name="gw" required="true" />
<cfset variables.taskGateway = arguments.gw />
</cffunction>
ColdSpring will create the Reactor factory bean and then use it to create the task gateway and will then inject it into the controller for you.
Magic!<cfargument name="gw" required="true" />
<cfset variables.taskGateway = arguments.gw />
</cffunction>

10 responses so far ↓
1 Damon Gentry // Mar 7, 2006 at 6:35 AM
BTW: Got Sleep? I've noticed your last few blogs have been posted at oh-dark-30 in the morning. Are these frameworks THAT interesting to work with?
2 Sean Corfield // Mar 7, 2006 at 7:38 AM
3 Matt Williams // Mar 7, 2006 at 9:32 AM
I'm hoping to do the same thing with Mach-II.
4 Erik-Jan // Mar 7, 2006 at 10:55 AM
I am very interested to see the example! When will it be available in the zip-file?
5 Sean Corfield // Mar 7, 2006 at 1:03 PM
Erik-Jan, I'm focusing on two things this week: Reactor performance and ColdSpring support for Reactor-generated objects. I expect to make the example available next week, after cf.Objective(), but it will require the BER of Model-Glue, ColdSpring and Reactor since there are changes in all three frameworks that allow them to really work smoothly together.
6 John Allen // Mar 15, 2006 at 10:53 AM
Thanks Sean for getting my spaghetti code neatly rolled up and into fun little boxes.
Cant wait to see the performance tweeks for CS.
7 Chris Tilley // Apr 3, 2006 at 11:34 AM
8 Sean Corfield // Apr 3, 2006 at 1:48 PM
I will post a new blog entry as soon as the example is running!
9 Joshua Scott // Jun 8, 2006 at 1:22 PM
When I try your example in MG 1.1 I get an error that a class is required for the gateway bean I am defining.
Any ideas?
- JS
10 Sean Corfield // Jun 8, 2006 at 7:57 PM
Leave a Comment