Just spent a few hours trying to get my M5 CB working with RC2 and
lightwire.
Took me a bit to realise there was no bundled lightwire as with other
versions so there is gotcha 1.
Had to change addBeanFromFactory function in BaseConfigObject.cfc to
below adding in the last 4 lines as without them the line
If
(StructCount(variables.Config[arguments.ObjectName].ConstructorDependencyStruct))
{ObjectDependencyList =
StructKeyList(variables.Config[arguments.ObjectName].ConstructorDependencyStruct);}
in getDependencyObjectList in Lightwire.cfc breaks
<cffunction name="addBeanFromFactory" returntype="void" hint="I add
the configuration properties for a Singleton or Transient that is
created by a factory to the config file." output="false">
<cfargument name="FactoryBean" required="true" type="string"
hint="The name of the factory to use to create this bean (the factory
must also have been defined as a Singleton in the LightWire config
file).">
<cfargument name="FactoryMethod" required="true" type="string"
hint="The name of the method to call on the factory bean to create
this bean.">
<cfargument name="BeanName" required="true" type="string" hint="The
required name to use to refer to this bean.">
<cfargument name="Singleton" required="true" hint="Whether the bean
is a Singleton (1) or Transient(0).">
<cfscript>
// Set the config properties for the Singleton
// Create the necessary struct
variables.config[BeanName] = StructNew();
// Set it as a Singleton
variables.config[BeanName].Singleton = Singleton;
// Set the Factory bean
variables.config[BeanName].FactoryBean = FactoryBean;
// Set the Factory method
variables.config[BeanName].FactoryMethod = FactoryMethod;
// Initialize the dependency lists
variables.config[BeanName].ConstructorDependencies = "";
variables.config[BeanName].SetterDependencies = "";
variables.config[BeanName].MixinDependencies = "";
variables.config[BeanName].InitMethod = "";
variables.config[BeanName].ConstructorDependencyStruct =
StructNew();
variables.config[BeanName].SetterDependencyStruct = StructNew();
variables.config[BeanName].MixinDependencyStruct = StructNew();
</cfscript>
</cffunction>
I think you only need the above if you create beans from factories
e.g. i have
<!-- So can get stuff from coldbox and inject it into other beans -->
<bean id="coldboxFactory" class="coldbox.system.ioc.ColdboxFactory" /
<bean id="iocPlugin" factory-bean="ColdboxFactory" factory-
method="getPlugin">
<constructor-arg name="plugin">
<value>ioc</value>
</constructor-arg>
</bean>
<bean id="coldboxController" factory-bean="ColdboxFactory" factory-
method="getColdbox">
</bean>
And just for kicks Lightwire no longer supports property replacement
in maps e.g. if you have someting like below it will no longer
replace the placeholders in the value fields
<constructor-arg name="userTypeIds">
<map>
<entry key="NO_USER_TYPE_ID">
<value>${NO_USER_TYPE_ID}</value>
</entry>
<entry key="REGISTERED_USER_TYPE_ID">
<value>${REGISTERED_USER_TYPE_ID}</value>
</entry>
<entry key="NON_REGISTERED_USER_TYPE_ID">
<value>${NON_REGISTERED_USER_TYPE_ID}</value>
</entry>
<entry key="CAMPAIGN_REGISTERED_USER_TYPE_ID">
<value>${CAMPAIGN_REGISTERED_USER_TYPE_ID}</value>
</entry>
</map>
</constructor-arg>
only things like this will get replaced
<property name="firstPartyMappedNewsletters">
<value>${FIRST_PARTY_WRAPPER_VALUES}</value>
</property>
take a look in translateBeanChildren method in
lightwire.BaseConfigObject youll see that substitution doesnt happen
for maps it seems
Hope this helps somebody