Just before MAX, I sent a new version of the ColdSpring DefaultXmlBeanFactory.cfc to the CS team with new code that implements the <import /> tag, which has now been committed to the main CVS repository:
<import resource="/path/to/file.xml" />
It supports the following path types:
- relative (../../my/path/file.xml)
- CF mappings (/modelglue/actionpack/foo/config/coldspring.xml)
- absolute or physical (d:\my\extra\cs\file.xml or /opt/to/useit.xml)
It simply includes the resource (which must be a valid ColdSpring xml file) as part of the current one, so when you load the beans from a file that uses import, the ones from the included file are created too. And it features recursion protection so it won't kill your server if two files accidentally include eachother. It just loads each one once.
So head over to
http://www.coldspringframework.org and check it out.
Laterz!
Comments
That is awesome! great addition.
Posted By Rob Gonda / Posted At 11/11/06 11:42 AM
Woot! I'd been trying <include /> instead of <import />.
Simply pimp. Gratz.
Posted By denny / Posted At 12/16/06 10:32 PM
I have tried for a couple of hours to get this to work and have not had any luck, could someone post a working snippet of this?
Posted By Trevor Orr / Posted At 10/21/08 9:55 AM
Trevor, can you post the tag you have?
Just FYI, a later revision of ColdSpring cut out absolute paths, so using drive letters or a UNIX path from / no longer works, it's just webroot- or mapping-relative and dot-notation relative paths.
If you post the way you're using the tag, it may help with figuring out what the issue is...
Posted By Jared Rypka-Hauer / Posted At 10/21/08 10:01 AM
You have to have a complete, valid ColdSpring file for the include, which means you need to have, at the very very minimum, <beans><bean /></beans> in the included file in order for it to work.
I'm posting this here just so that it's available for anyone else having this issue.
Posted By Jared Rypka-Hauer / Posted At 10/21/08 10:28 AM