Java doesn't have named arguments, that's why Spring doesn't even have the name="" attribute on the <constuctor-arg/> tag. All ColdFusion arguments are named (isn't name="" a required attribute of <cfargument/> ?) and they aren't "hidden" from anyone (they are available in metadata). Many people use the init(argName1=argValue1) syntax, and others use init(argumentCollection=structOfArguments). I personally do it the way you do (ordered arguments), but I've never felt bad about naming them in the CS xml.
Other issues: Our instantiation logic relies heavily on CFInvoke (see line 500 in http://code.coldspringframework.org:9010/viewrep/Coldspring2/coldspring/beans/DefaultXmlBeanFactory.cfc?r=1.36 ) Autowiring by name would not work. Factory-bean/method would get messed up. Basically, I'm not in favor of this. If others are interested, I'd like to hear why, but it seems like a lot of work for no perceived benefit (IMO) -Dave On 6/8/06, Jon Gunnip <[EMAIL PROTECTED]> wrote:
Hey, I was wondering why name is a required attribute in the constructor-arg tag. I prefer using <constructor-arg/> over <property/> (especially when the components already exist) but I'm uncomfortable binding the ColdSpring XML to the names of Init()'s arguments since I always call functions as an ordered list and usually consider the argument names to be hidden from the user. Why not just call the Init() with the arguments in the order as they are defined in the XML file? This is supported in Spring and according to the Spring docs it is the preferred method of using constructor-arg. (they actually recommend specifying the optional index attribute on constructor-arg - e.g. index="0"). See http://static.springframework.org/spring/docs/1.1.5/reference/beans.html#d0e745 Would this just be too messy to implement in CF? I imagine it could be done with Evaluate() or with a switch statement for every possible length of arguments (e.g. 1-argument Init(), 2-argument Init(), etc.). Thanks! Jon
