On 7/18/06, Perry Woodin <[EMAIL PROTECTED]> wrote:
After setting this up, I went back to look at some of the examples that ship with ColdSpring and noticed that <property> seems to be used in favor of <constructor-arg>. Is there a general rule for when to use one over the other?
Dave Ross, in his presentation at CFUNITED, said "favor setter injection over constructor injection". Setter injection supports circular dependencies, constructor injection does not (pretty much by definition). It's better (IMO) to have objects constructed with just the data they need in order to be usable and then inject everything else. In general, I only use constructor injection for simple scalar values (e.g., strings) and use setter injection for more complex properties. -- Sean A Corfield -- http://corfield.org/ Got frameworks? "If you're not annoying somebody, you're not really alive." -- Margaret Atwood
