ColdSpring arrays and structs
I found out today that you can create structs and arrays in the ColdSpring configuration file. I've haven't actually used it yet, but it could be quite useful for setting up configurations.
Here's how you do it.
<!--
I am an example of a struct / map in coldspring
-->
<bean id="MailServerConfig" class="coldspring.beans.factory.config.MapFactoryBean">
<property name="SourceMap">
<map>
<entry key="ServerHostName"><value>127.0.0.1</value></entry>
<entry key="ServerUsername"><value>foo</value></entry>
<entry key="ServerPassword"><value>bar</value></entry>
</map>
</property>
</bean>
<!--
I am an example of an array in coldspring
-->
<bean id="AuditOperations" class="coldspring.beans.factory.config.ListFactoryBean">
<property name="SourceList">
<list>
<value>create</value>
<value>edit</value>
<value>delete</value>
</list>
</property>
</bean>
Because they are both declared as beans, you can inject them as you normally would via autowire or manually setting up the dependancy.
<bean id="MyObject" class="myPath.MyObject">
<!-- set the dependancy manually -->
<property name="AuditOperations">
<ref bean="AuditOperations" />
</property>
</bean>
- Posted in:
- ColdFusion
- Coldspring


Comment by Sean Corfield – March 06, 2009
Comment by John Whish – March 06, 2009
Comment by Bob Silverberg – March 07, 2009
Comment by John Whish – March 07, 2009
Comment by greg cerveny – March 10, 2009
Comment by John Whish – March 10, 2009