|
From: Rob B. <rob...@ve...> - 2003-11-09 22:53:41
|
I would agree this is very good stuff! This is especially useful if you want to use a third party api but they do not conform to javabean style no-arg contructors. However by limiting the implementation to only support classes that have a single constructor you are all but defeating its usefulness. The only reason you would be forced to use / need this kind of a feature is if you don't have access to the code to implement a no-arg constructor. For that same reason, you cannot modify the code to only have 1 constructor. I would wager that most classes that do provide a constructor which takes args also supply variations that take more / less args. So if multiple constructors are not supported, it's probably not going to be very useful. Spring is already amazing, and you guys just keep making it better. Good work! Later Rob > > > >The only limitation is that constructor-wired components are just allowed to have one single constructor. This is also what Pico recommends, although they have some heuristic kind of constructor choice in case of multiple constructors now. I guess we can limit this to one single constructor for the time being. Of course, standard beans defined without autowire="constructor" or "constructor-arg" tags can still have any number of constructors, the only requirement being that they must provide a no-arg constructor. > > > > > One way you could do it (which you probably thought of) is by allowing > the deployer to specify, in the case of the indexed variant, an optional > 'type' attribute which specifies the real type (in the receiving object) > of that constructor argument. This would allow the appropriate > constructor to be picked without any ambiguity. I don't know if this is > worth doing or not, but on the other hand, if you are going to support > constructors at all, it's somewhat arbitrary to stop at 1 if you can > figure out a relatively simple (albeit wordy) way to support the > multiple case. > > Even if that is not done, maybe it is worth it supporting the special > case of classes which have a no-arg constructor, and one other > constructor with one or more args. That's also a pretty common case, and > easy to support. > > Regards, > Colin > > > > > > > ------------------------------------------------------- > This SF.Net email sponsored by: ApacheCon 2003, > 16-19 November in Las Vegas. Learn firsthand the latest > developments in Apache, PHP, Perl, XML, Java, MySQL, > WebDAV, and more! http://www.apachecon.com/ > _______________________________________________ > Springframework-developer mailing list > Spr...@li... > https://lists.sourceforge.net/lists/listinfo/springframework-developer |