I also tend not to use constructor injection so much these days, but I still don¹t love setter injection as there is no real way of distinguishing intent between setters that should never be called by your app from those that should be (is setXXX() part of the API of your UserService or just something you need CS to inject). Always thought that wasn¹t ideal, but I haven¹t really seen much is the CF or Java worlds about it. Anyone got any thoughts?
Best Wishes, Peter On 7/10/07 5:13 PM, "Brian Kotek" <[EMAIL PROTECTED]> wrote: > I agree with Jarod. Without ColdSpring, I would say that constructor injection > is preferred. However, since ColdSpring won't give you back an object to use > until all the dependencies have been resolved, there is no danger of getting > an "incomplete" object. I favor the setter injection since one never knows > when a circular dependency will pop up in the future, so just going with > setter injection to begin with can save some rework down the line. > > > On 7/9/07, Jared Rypka-Hauer <[EMAIL PROTECTED]> wrote: >> There's also constructor-injection, which passes anything defined in >> <constructor-arg /> tags to the init() method of the CFC (or whatever you've >> defined as your constructor) the same as things are passed to <property /> >> tags, only at instantiation time, not after instantiation. >> >> I used to strongly favor constructor injection... lately I've swung over to >> property injection unless there's a compelling reason to do otherwise. >> >> >> >> >> J >> >> >> >> ------------------------------------------------ >> >> Jared C. Rypka-Hauer >> >> Continuum Media Group LLC >> >> http://www.web-relevant.com >> >> >> >> > >
