For CFGroovy 1.1, I want to do this sort of thing, where GroovyFactoryBean will instantiate the specified Groovy object and return it, suitable for injecting into an arbitrary CFC of choice:
<bean id="groovyFactory" class="cfgroovy.GroovyFactoryBean">
<constructor-arg name="cfgroovy"><ref bean="cfgroovy" /></constructor-arg>
</bean>
<bean class="cfcs.service">
<constructor-arg name="dao">
<bean factory-bean="groovyFactory" factory-method="getObject">
<constructor-arg name="clazz"><value>com.barneyb.Dao</value></constructor-arg>
</bean>
</constructor-arg>
</bean>
That XML is taken from a working app, but it has all kinds of problems. In case it's not obvious what's happening, 'cfcs.service' is a CFC whose constructor is passed a Groovy bean (of type 'com.barneyb.Dao'). The Groovy object is instantiated by the 'cfgroovy.GroovyFactoryBean' bean. I've considered Spring, but I don't want to mix the Spring and ColdSpring dialects, add the extra JARs, or force splitting beans into separate XML files based on language.
Anyone have thoughts on the matter? And the base ground-rules for CFGroovy, if you don't remember, are as follows (so don't violate them):
- CTRL-S, ALT-TAB, F5 must work in every case, no container restarts.
- Code must work on CF8.0.1 and Railo 3.0
Comments are closed.