Model Glue Tips: Splitting out ColdSpring

Posted by Mark Drew on code on October 27, 2007

Tagged under coldfusion,coldspring

A comment posted in my entry about Model Glue Tips Part 1: Separate out your Model-Glue file reminded me that I should continue with some of those postings.

One of the things that happens when you start building larger applications is that you get a lot of objects that you are managing with ColdSpring. This means that the file can get rather large, and again that is a bad thing right (I keep going on about this to lots of people that write CF, the same goes for your XML files).

There are other reasons to split out the ColdSpring file, apart from a neatness. One of our applications actually creates other ModelGlue applications. And each one of these has separate configurations and in fact available objects (they are automatically written out) as well as maybe some custom configurations.

The problem would be that if you update the core code, that is, objects that are core to the system, you dont want to be messing about with merging these files together, so I tend to split things out something like:

  • ColdSpring.xml   <- Main (Core) ColdSpring File
  • ColdSpring_Config.xml  <- Automatically written file that has our DSN, reactor and other site specific settings
  • ColdSpring_Custom.xml <- Custom settings and mappings for the application

All these files are complete ColdSpring files in themselves (that is, they start with <beans>) and are imported into the main ColdSpring file as imports:

    ....
   <!-- The rest of the core files -->

</beans>

</code> Once you have done this, beans in the external files are loaded as normal.

A quick note, and I haven’t checked this properly, but this works in the bleeding edge version of ColdSpring which you can get through CVS following the instructions here: http://www.coldspringframework.org/index.cfm?objectid=2DD5F8AF-DD05-F8C8-7860429E21850D7E

<p style="font-size:10px;text-align:right;">Tags: , , </p>




comments powered by Disqus